Numbered lists shows spaces before and after the list

Technical support for Spire.PDF

Moderator: iceblue support

Numbered lists shows spaces before and after the list

Postby DarrenPrunty1 » Mon Jul 31, 2017 4:08 pm

When I use a numbered list in a Rich Text Editor and use the HTML output to generate a document. There is always a space before and after this section.

Is there any way to remove or restyle this so that there's no massive space created? Via the spire object model?

See attachment.
You do not have the required permissions to view the files attached to this post.
DarrenPrunty1
 
Posts: 4
Joined: Mon Jul 31, 2017 3:58 pm

Re: Numbered lists shows spaces before and after the list

Postby Jane.Bai » Tue Aug 01, 2017 2:15 am

Hello,

After initial test, I didn't encounter the issue you mentioned. Could you please sent your sample html file and code to us(support@e-iceblue.com) for a better investigation?

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 430
Joined: Tue Nov 29, 2016 1:47 am

Re: Numbered lists shows spaces before and after the list

Postby DarrenPrunty1 » Tue Aug 01, 2017 12:24 pm

GenerateDocumentFromHtml.zip


Hi Jane,

Attached is a console application in C# I used to reproduce the issue.

Hopefully you can get it compiling. The HTML I used is in the Settings file in the application. It's also at the Root level folder for the application called "Sample HTML.txt".

Let me know if you can help thanks!

Thanks,
Darren
You do not have the required permissions to view the files attached to this post.
DarrenPrunty1
 
Posts: 4
Joined: Mon Jul 31, 2017 3:58 pm

Re: Numbered lists shows spaces before and after the list

Postby Jane.Bai » Wed Aug 02, 2017 3:08 am

Hello Darren,

I have also received your letter, thanks for that.
I have noticed that there are many <br/> tags in your html file. Kindly note the <br/> tags will be parsed as soft returns, and the soft returns take up spaces. When you open your html file as a web page or open it in Word, you will see the same format. Moreover, since the paragraph before spacing and after spacing are set as the minimum value in the document, it can’t be changed to the narrow the space any more. To conclude, there’s no proper way to get what you want at present, we suggest you modifying your html string and remove the redundant <br/> tags.
So sorry for the inconvenience caused.

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 430
Joined: Tue Nov 29, 2016 1:47 am

Re: Numbered lists shows spaces before and after the list

Postby DarrenPrunty1 » Fri Aug 04, 2017 1:30 pm

Hi Jane,

Thank you for reply and guidance. I managed to get a workaround to work in our application.

There is one more thing I'm wondering. Have you an idea why the numbers in the <ol> don't adhere to the font-family and font-size of the text value in each item.

The numbers are Times New Roman and have a font size of 10. Our standard is Segoe UI with a font size of 12.

I'll keep looking in the meantime but any pointers would be appreciated.

Thanks,
Darren
DarrenPrunty1
 
Posts: 4
Joined: Mon Jul 31, 2017 3:58 pm

Re: Numbered lists shows spaces before and after the list

Postby Jane.Bai » Mon Aug 07, 2017 6:58 am

Hello Darren,

Thanks for your reply.
Here on my side, I have noticed the issue. This happens because we have given a uniform font family(TimeNewRoman) and font size as the default font setting for the numbers in the ordered list. I have referred this issue to our dev team for a further investigation and if there's any good news, I'll let you know. To avoid this trouble, here's a temporary workaround, that is to set the number format and size mannually like below.
Code: Select all
 Document doc = new Document();
            doc.LoadFromFile(@"Sample HTML.html",FileFormat.Html,XHTMLValidationType.None);
           //you have to know the paragraph of the list
            ListFormat lf=doc.Sections[0].Paragraphs[1].ListFormat;
            lf.CurrentListLevel.CharacterFormat.FontName = "Segoe UI";
            lf.CurrentListLevel.CharacterFormat.FontSize = 12;
            doc.SaveToFile(@"C:\Users\Administrator\Desktop\Sample HTML.docx",FileFormat.Docx);

Hope it helps.

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 430
Joined: Tue Nov 29, 2016 1:47 am

Re: Numbered lists shows spaces before and after the list

Postby DarrenPrunty1 » Wed Aug 09, 2017 10:18 am

Hi Jane,

I found a workaround using your approach.

Thanks for your help.

Darren
DarrenPrunty1
 
Posts: 4
Joined: Mon Jul 31, 2017 3:58 pm

Re: Numbered lists shows spaces before and after the list

Postby Jane.Bai » Wed Aug 09, 2017 10:26 am

Hello Darren,

Thanks for your feedback.
I will also inform you once there's any good news on the issue I posted to our dev team.

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 430
Joined: Tue Nov 29, 2016 1:47 am


Return to Spire.PDF

Who is online

Users browsing this forum: No registered users and 0 guests