- 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