Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Sep 17, 2019 6:09 am

Hi,

When using:
doc.HtmlExportOptions.CssStyleSheetType = CssStyleSheetType.Internal;
doc.SaveToFile(fileName, FileFormat.Html);

We have noticed that there is an inconsistency in the style attribute whether widths, margins etc that are not whole numbers have their decimals separated by a comma or a dot. Please see the attachment as an example.

We would prefer if this behavior was consistent and preferably dots. Is there a way to achieve this?

Thank you!
/Fredrik

fredan
 
Posts: 9
Joined: Tue Jun 19, 2018 6:52 am

Tue Sep 17, 2019 7:24 am

Hi Fredrik,

Thanks for your inquiry.
To help us investigate accurately, please provide following information:
1. Your input and output file.
2. The full code you used.
3. The OS and Region information, e.g. Win7 64bit, China/Chinese.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Sep 17, 2019 8:22 am

Hi Betsy,

1. See attachments.

2.
Document document = new Document();
document.LoadFromFile("C:\\Temp\\Documents\\Example.docx");
document.HtmlExportOptions.CssStyleSheetType = CssStyleSheetType.Internal;
document.SaveToFile("C:\\Temp\\Documents\\Example.html", FileFormat.Html);

3. Windows 10 Pro, Region: Sweden. Display language English(United states).

Thank you!

fredan
 
Posts: 9
Joined: Tue Jun 19, 2018 6:52 am

Tue Sep 17, 2019 10:07 am

Hi,

Thanks for your information.
Please refer to following code to set the culture, then the whole numbers are separated by a dot.
Code: Select all
            CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            Document document = new Document();
            document.LoadFromFile(FilePath +"Example18926.docx");
            document.HtmlExportOptions.CssStyleSheetType = CssStyleSheetType.Internal;
            document.SaveToFile("18926-thread.html", FileFormat.Html);

            Thread.CurrentThread.CurrentCulture = currentCulture;


Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Sep 17, 2019 11:28 am

Hi Betsy,

It seems to work. However, I have a few questions:
How come that the commas and decimals are mixed if I do not set the culture to InvariantCulture? Shouldn't the behavior be consequent?
<table style="width:10.5pt;margin-left: 5,25pt">
<tr>
<th>Firstname</th>

Also, is html really culture specific according to the W3C standard? Why should Spire produce invalid html in any case in this scenario?

Thanks!
/Fredrik

fredan
 
Posts: 9
Joined: Tue Jun 19, 2018 6:52 am

Wed Sep 18, 2019 3:32 am

Hi Fredrik,

Thanks for your information.
Actually, I had logged the issue in our bug tracking system. Once it is fixed, there is no need for you to set culture. And I got information that the issue is submitted to our test team. Once the hotfix is available, we will let you know. And before getting the hotfix, please firstly use the code I provided as solution.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Sep 18, 2019 6:11 am

Hi Betsy,

Ok! Great!

/Fredrik

fredan
 
Posts: 9
Joined: Tue Jun 19, 2018 6:52 am

Return to Spire.Doc