Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Wed Mar 04, 2020 11:44 am

This results in PNG images with transparency appear blurry or with low resolution.

Code: Select all
using (var document = new Spire.Doc.Document())
{
    document.LoadFromFile(file);

    using (var d = document.Clone())
    {
        d.SaveToFile(resultFile);
    }
}

profiler007
 
Posts: 17
Joined: Wed Nov 13, 2019 11:32 am

Thu Mar 05, 2020 2:10 am

Hello,

Thanks for your inquiry.
I simulated your case with the latest Spire.Office Platinum (DLL Only) Version:5.2.0 but didn't reproduce your issue. To help us investigate it more accurately, please provide your input file as well as your output file. You could upload here or send them to us(support@e-iceblue.com) via email. Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 654
Joined: Tue Jul 09, 2019 2:22 am

Thu Mar 05, 2020 7:38 am

Hello,

I also tried with the latest version of Spire.Doc - 8.3.0.4046.

Steps to reproduce:

1. Open sample data\original file\PNG with transparency.docx with Word and save it as Web Page, Filtered. The resulting html is ok. PNG with transparency_files contains two PNG files.
2. Use the following code to open and save the same file somewhere (in my example saved with spire):

Code: Select all
using (var document = new Spire.Doc.Document())
{
    document.LoadFromFile(file);

    using (var d = document.Clone())
    {
        d.ViewSetup.DocumentViewType = DocumentViewType.PrintLayout;

        d.SaveToFile(resultFile);
    }
}

3. Open the saved document with Word and save it as Web Page, Filtered. The resulting html is not ok. The first image is ugly. PNG with transparency_files contains two GIF files.

Regards
You do not have the required permissions to view the files attached to this post.
Last edited by profiler007 on Thu Mar 05, 2020 10:58 am, edited 1 time in total.

profiler007
 
Posts: 17
Joined: Wed Nov 13, 2019 11:32 am

Thu Mar 05, 2020 10:24 am

Hello,

Thanks for your sharing.
I have reproduced your issue and logged it to our bug tracking system with the ticket SPIREDOC-4017. Once there is any update, we will let you know. Sorry for the inconvenience caused.
Besides, I found if using our Spire.Doc to convert the saved document to html, the first image is not blurry, you could take this as a temporary solution. Below is the corresponding code for reference.
Code: Select all
    using (var document = new Spire.Doc.Document())
    {
        document.LoadFromFile("PNG with transparency.docx");
        using (var d = document.Clone())
        {
            d.ViewSetup.DocumentViewType = DocumentViewType.PrintLayout;
            d.SaveToFile("clone.docx");
        }
    }
    Document doc = new Document();
    doc.LoadFromFile("clone.docx");
    doc.SaveToFile("result.html", FileFormat.Html);


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 654
Joined: Tue Jul 09, 2019 2:22 am

Mon Apr 06, 2020 4:39 pm

Hello again,

we have another client asking about the same problem. Sample template is attached.

At this point we still have to use MS Office convert to HTML. Converting to HTML with Spire is in our plans but at at this point we consider this as a little risky.

Regards,
Velislav
You do not have the required permissions to view the files attached to this post.

profiler007
 
Posts: 17
Joined: Wed Nov 13, 2019 11:32 am

Tue Apr 07, 2020 2:16 am

Hi Velislav,

Thanks for your contacting.
After further investigation by our Dev team, we found that to make the web settings of the cloned document consistent with the source document, you need to invoke the CloneWebSettingsTo method additionally. Please refer to the following modified code. If there is any question, please feel free to write back.
Code: Select all
    using (var document = new Spire.Doc.Document())
    {
        document.LoadFromFile("Template.docx");

        using (var d = document.Clone())
        {
            d.ViewSetup.DocumentViewType = DocumentViewType.PrintLayout;
            //Clone the web settings of the source document
            document.CloneWebSettingsTo(d);
            d.SaveToFile("clone.docx");
        }
    }

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 654
Joined: Tue Jul 09, 2019 2:22 am

Tue Apr 07, 2020 6:17 am

It works, thanks!

profiler007
 
Posts: 17
Joined: Wed Nov 13, 2019 11:32 am

Tue Apr 07, 2020 6:24 am

Hi Velislav,

Glad to hear that!
If you need further assistance, please feel free to contact us.
Wish you all the best!

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 654
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.Doc