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 Apr 10, 2018 5:23 pm

Thanks a lot for all your help!

I have a question. Is there a way to insert a blank line prior to 'Page 1 of ...'? Here is my code

Shared Sub AddPageNumber(ByVal doc As Spire.Doc.Document, ByVal sec As Spire.Doc.Section)
''instantiate a character format object and set the font size and family as well as the color
Dim footer As Spire.Doc.HeaderFooter
Dim footerParagraph As Spire.Doc.Documents.Paragraph
Dim text As Spire.Doc.Fields.TextRange
Dim field As Spire.Doc.Fields.Field
Dim cf As New Spire.Doc.Formatting.CharacterFormat(doc)
cf.Font = New Drawing.Font("Arial", 9)
cf.TextColor = Drawing.Color.Black

''build footer page number info
footer = sec.HeadersFooters.Footer
footerParagraph = footer.AddParagraph()
text = footerParagraph.AppendText(" ") <------ trying to insert blank line but it does not work
text.ApplyCharacterFormat(cf)
text = footerParagraph.AppendText(" Page ")
text.ApplyCharacterFormat(cf)
field = footerParagraph.AppendField("page number", Spire.Doc.FieldType.FieldPage)
field.ApplyCharacterFormat(cf)
text = footerParagraph.AppendText(" of ")
text.ApplyCharacterFormat(cf)
field = footerParagraph.AppendField("number of pages", Spire.Doc.FieldType.FieldNumPages)
field.ApplyCharacterFormat(cf)
footerParagraph.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center
End Sub

tlerner
 
Posts: 32
Joined: Mon Aug 14, 2017 5:49 pm

Wed Apr 11, 2018 3:23 am

Hi,

Thanks for your inquiry.
kindly note the footerParagraph.AppendText(" ") just appends text to paragraph instead of inserting a blank line. Please add a new paragraph before the page number paragraph to reach a blank line effect.
Sample code:
Code: Select all
...
footer = sec.HeadersFooters.Footer
//Add a paragraph
footerParagraph = footer.AddParagraph()
'text = footerParagraph.AppendText(" ");
'text.ApplyCharacterFormat(cf);
//Add a paragraph
footerParagraph = footer.AddParagraph()
text = footerParagraph.AppendText(" Page ")
...

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Mon Apr 16, 2018 8:23 am

Hello,

Greetings from E-iceblue.
Did we fix your issue?
Thanks in advance for your valuable feedback and time.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Wed Apr 18, 2018 5:12 pm

Thank you, Nina!
The issue with spaces before 'Page..of..' is resolved. Thank you for your suggestions.
The issue regarding 'hr' and 'breaks'... I resolved those by moving needed code outside of the <table> tags.
We still wait for the issue that needs to be resolved with 'display', but for now we have a work around.

Thanks again!
Tanya Lerner

tlerner
 
Posts: 32
Joined: Mon Aug 14, 2017 5:49 pm

Thu Apr 19, 2018 1:29 am

Dear Tanya,

Thanks for your valuable feedback.
Our Dev team is making efforts to fix the "hr" and "display" issue. Once there is any good news, we will inform you.
Have a nice day!

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Tue May 08, 2018 6:47 am

Dear Tanya,

Thanks for your patient waiting.
We just released the Spire.Office Platinum (DLL Only) Version:3.4.2 which fixes both "hr" and "display" issue. Welcome to test and any feedback will be greatly appreciated.

Best wishes,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Thu May 10, 2018 3:29 am

Hello,

Greetings from E-iceblue.
Have your issued been fixed with the hotfix?
Thanks in advance for your valuable feedback and time.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Thu Oct 25, 2018 1:15 pm

Hello Spire,

Actually I am using your Spire.PDF dll full version to convert my HTMl source code to PDF. The page gets converted very well using your Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert() function where i am passing my sourceHtml code as a parameter.

The problem arising when i want to add a customize page number to the new plugin code, I am not able to find any code or parameter which i can use to add custom page number.

There was an option in the older version which we could use to add the custom page number, could you please let me know how i can achieve that using the newer version plugin.

Kindly let me know if you need anything from my end

Thanks,

smrt_sarang
 
Posts: 2
Joined: Thu Oct 25, 2018 1:08 pm

Thu Oct 25, 2018 2:40 pm

Just in case if this will help you, here is my code to add a page number. I use SpireDoc .dll

Shared Sub AddPageNumber(ByVal spireDoc As Doc.Document, ByVal sec As Doc.Section)
''instantiate a character format object and set the font size and family as well as the color
Dim footer As Doc.HeaderFooter
Dim footerParagraph As Doc.Documents.Paragraph
Dim text As Doc.Fields.TextRange
Dim field As Doc.Fields.Field
Dim cf As New Doc.Formatting.CharacterFormat(spireDoc)
cf.Font = New Drawing.Font(Constance.cArial, 9)
cf.TextColor = Drawing.Color.Black

''build footer
footer = sec.HeadersFooters.Footer
''Add a paragraph - blank line
footerParagraph = footer.AddParagraph()
''Add a paragraph - page number
footerParagraph = footer.AddParagraph()
text = footerParagraph.AppendText(" Page ")
text.ApplyCharacterFormat(cf)
field = footerParagraph.AppendField("page number", Doc.FieldType.FieldPage)
field.ApplyCharacterFormat(cf)
text = footerParagraph.AppendText(" of ")
text.ApplyCharacterFormat(cf)
field = footerParagraph.AppendField("number of pages", Doc.FieldType.FieldNumPages)
field.ApplyCharacterFormat(cf)
footerParagraph.Format.HorizontalAlignment = Doc.Documents.HorizontalAlignment.Center
End Sub

tlerner
 
Posts: 32
Joined: Mon Aug 14, 2017 5:49 pm

Fri Oct 26, 2018 8:54 am

Hello Samrat,

Thanks for your inquiry.
Kindly note that there isn't related parameter to add the custom page number when using Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert() function. You have to add page number to the generated Pdf, please refer to following tutorial. If there is any question, welcome to write back.
How to Add Page Numbers to Existing PDF Document in C#

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Tue Oct 30, 2018 6:16 am

Hello Samrat,

Greetings from E-iceblue.
How is your issue now? Thanks in advance for your valuable feedback and time.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.Doc