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 Sep 08, 2021 12:47 pm

Hello, I am trying to use Spire.Doc to Insert table in html to docx file and save it as Pdf. Sometimes it works and sometimes it doesnt. Following piece of code can reproduce an error

Code: Select all
static void Main(string[] args)
        {
            Spire.Doc.Document doc = new Spire.Doc.Document();

            string htmlSource = @"<html>
   <body>
      <table>
         <tr>
            <th colspan=3>Hour</th>
            <th>03.09.2021 01:00</th>
            <th>03.09.2021 02:00</th>
            <th>03.09.2021 03:00</th>
            <th>03.09.2021 04:00</th>
            <th>03.09.2021 05:00</th>
            <th>03.09.2021 06:00</th>
            <th>03.09.2021 07:00</th>
            <th>03.09.2021 08:00</th>
            <th>03.09.2021 09:00</th>
            <th>03.09.2021 10:00</th>
            <th>03.09.2021 11:00</th>
            <th>03.09.2021 12:00</th>
            <th>03.09.2021 13:00</th>
            <th>03.09.2021 14:00</th>
            <th>03.09.2021 15:00</th>
            <th>03.09.2021 16:00</th>
            <th>03.09.2021 17:00</th>
            <th>03.09.2021 18:00</th>
         </tr>
         <tr>
            <th>ABC</th>
            <th>TS3 (Subject, Service)</th>
            <th>Service PR</th>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
            <td>10,00000000</td>
         </tr>
      </table>
   </body>
</html>";

            Section section = doc.AddSection();
            var para = section.AddParagraph();
            para.AppendHTML(htmlSource);

            // save to doc works
            //doc.SaveToFile(@"C:\temp\doc.docx");

            // save to pdf doesnt
            doc.SaveToFile(@"C:\temp\doc.pdf", Spire.Doc.FileFormat.PDF);
        }


Error message: System.ArgumentException: Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results
Stacktrace: v System.Collections.Generic.IntrospectiveSortUtilities.ThrowOrIgnoreBadComparer(Object comparer)
v System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)
v System.Array.Sort[T](T[] array, Int32 index, Int32 length, IComparer`1 comparer)
v System.Collections.Generic.List`1.Sort(Int32 index, Int32 count, IComparer`1 comparer)
v spr᧲.ᜀ(List`1 A_0, Single A_1, Single A_2)
v spr᧲.ᜀ(Single A_0, spr᧲ A_1, Boolean A_2)
v spr᧰.ᜁ(Table A_0, spr᧲ A_1, Single A_2, Single A_3)
v spr᧰.ᜂ(Table A_0, Single A_1)
v spr᧰.ᜅ(Table A_0, Single A_1)
v spr᧰.ᜀ(RectangleF A_0)
v spr᧰.ᜂ(RectangleF A_0)
v spr᧬.ᜋ(spr᧫ A_0)
v spr᧬.ᜁ(RectangleF A_0)
v spr᧬.ᜋ(spr᧫ A_0)
v spr᧬.ᜁ(RectangleF A_0)
v spr᧜.ᜀ(spr᧍ A_0, sprᧇ A_1, spr⁁ A_2)
v spr‹.ᜒ()
v spr‹.ᜓ()
v spr‹.ᜀ(IDocument A_0)
v spr₏.ᜀ(Document A_0)
v spr₏.ᜀ(Document A_0, ToPdfParameterList A_1)
v Spire.Doc.Document.ᜇ(String A_0)
v Spire.Doc.Document.SaveToFile(String fileName, FileFormat fileFormat)
v PrototypSestavy.SpireProgram.Main(String[] args) v C:\Workspace\Prototypes\PrototypSestavy\PrototypSestavy\SpireProgram.cs:řádek 91

papatoca
 
Posts: 9
Joined: Wed Sep 08, 2021 12:41 pm

Thu Sep 09, 2021 3:00 am

Hello,

Thanks for your inquiry.
I tested your case and did reproduce your issue. I have logged it in our bug tracking system with the ticket SPIREDOC-6665. If there is any update, we will let you know.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Thu Sep 09, 2021 8:59 am

Thank you for fast reply.

I have been experimenting a bit and it seems like setting doc.UseNewEngine = true solves the issue.
Unfortunately this leads to another issue - if header or footer of the page contains page number it is rendered same on all pages in generated pdf document.

Docx file to test it is enclosed. Program to reproduce the issue:

Code: Select all
static void Main(string[] args)
{
            Spire.Doc.Document doc = new Spire.Doc.Document(@"C:\temp\paging.docx");

            doc.UseNewEngine = true;
            doc.SaveToFile(@"C:\temp\paging.pdf", Spire.Doc.FileFormat.PDF);
}


If you open generated PDF file you will see Page 1 at the end of each page

papatoca
 
Posts: 9
Joined: Wed Sep 08, 2021 12:41 pm

Thu Sep 09, 2021 10:45 am

Hello,

Thanks for your response.
We are sorry that the "doc.UseNewEngine" provided by Spire.Doc is not fully implemented. Please do not use this method currently.
As for the issue of SPIREDOC-6665, if there is any update, we will notify you in time.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Wed Sep 15, 2021 9:02 am

Hello again,
do you have an idea when issue SPIREDOC-6665 will be fixed? It is blocking me a lot. Thank you very much

papatoca
 
Posts: 9
Joined: Wed Sep 08, 2021 12:41 pm

Wed Sep 15, 2021 10:03 am

Hello,

Thanks for your response.
Sorry that we are unable to tell you an estimated time about fixing at this moment. Our Dev team is still investigating your issue. Anyway, once there is any update, we will inform you ASAP.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Wed Jan 19, 2022 2:27 pm

Hello.
Do you have any updates on this issue? It has been a while and its becaming a huge blocker for me.

Thank you.

papatoca
 
Posts: 9
Joined: Wed Sep 08, 2021 12:41 pm

Thu Jan 20, 2022 8:43 am

Hello,

Thanks for your follow up.
The issue of SPIREDOC-6665 has been resolved. It is now under the testing phase. Once it passes the test, we will prepare a new version for you. Thanks for your patience.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Fri Feb 18, 2022 6:04 am

Hello,
that is great news. Thank you for your efford.

papatoca
 
Posts: 9
Joined: Wed Sep 08, 2021 12:41 pm

Fri Feb 18, 2022 10:26 am

Hello,

You're welcome!
If there is any update, I'll inform you in time.
Have a nice day.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1101
Joined: Wed Apr 07, 2021 2:50 am

Fri Apr 01, 2022 8:14 am

Hello again. What is the progress for this bug? I have just downloaded latest stable version of spire.doc (10.3.5.0) and the issue is still there.

papatoca
 
Posts: 9
Joined: Wed Sep 08, 2021 12:41 pm

Fri Apr 01, 2022 9:17 am

Hello,

Thanks for following up.
For word to PDF, we provide a new engine method. I tested the issue SPIREDOC-6665 using this method and found the issue solved. Please test the following code with the latest Spire.Doc Pack(hot fix) Version:10.3.5.
Code: Select all
...
document.UseNewEngine = true;
document.SaveToFile("doc.pdf", FileFormat.PDF);

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1101
Joined: Wed Apr 07, 2021 2:50 am

Fri Apr 01, 2022 10:58 am

Thu Sep 09, 2021 10:45 am

Hello,

Thanks for your response.
We are sorry that the "doc.UseNewEngine" provided by Spire.Doc is not fully implemented. Please do not use this method currently.
As for the issue of SPIREDOC-6665, if there is any update, we will notify you in time.

Sincerely,
Brian
E-iceblue support team



Thank you for quick response. Does that mean the above citation is no longer true?

papatoca
 
Posts: 9
Joined: Wed Sep 08, 2021 12:41 pm

Sat Apr 02, 2022 1:16 am

Hello,

Thanks for your feedback.
Yes, the "document.UseNewEngine" method provided by our Spire.Doc has been officially released and can be used normally.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1101
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.Doc