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.

Thu Jan 23, 2014 4:48 pm

Hi,

I am trying to insert page number with background border image manually. Please check the Attachment for more understanding. I am using dll version of 4.8.6.53040

Please reply me as soon as possible.

Thank you very much,

ahamed
 
Posts: 15
Joined: Mon Aug 15, 2011 1:09 pm

Fri Jan 24, 2014 7:27 am

Hello,

Thanks for your inquiry.
I provide you sample code as below. Sorry that in the version 4.8.6.53040 has a bug which effects the function.
We have fixed the bug in Spire.Doc for .NET Standard Edition Version:5.0.
Welcome to use the version to test the function.
Downloading link:http://www.e-iceblue.com/Download/download-word-for-net-now.html

Code: Select all
            Section section = document.Sections[0];

            HeaderFooter header = section.HeadersFooters.Header;
            Paragraph headerParagraph = header.AddParagraph();
            DocPicture headerPicture
                = headerParagraph.AppendPicture(Image.FromFile(@"..\..\001.PNG"));

            headerPicture.TextWrappingStyle = TextWrappingStyle.Behind;

            headerPicture.HorizontalAlignment = ShapeHorizontalAlignment.Right;   
            headerPicture.HorizontalOrigin = HorizontalOrigin.Margin;
            headerPicture.VerticalAlignment = ShapeVerticalAlignment.Top;
            headerPicture.VerticalOrigin = VerticalOrigin.Page;

            TextBox textbox = headerParagraph.AppendTextBox(20, 30);
            textbox.Format.NoLine=true;
            textbox.Format.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
            textbox.Format.HorizontalOrigin = HorizontalOrigin.Margin;
            textbox.Format.HorizontalPosition = 395;
            textbox.Format.VerticalOrigin = VerticalOrigin.Page;
            textbox.Format.VerticalPosition = 36;

            Paragraph pageNumber = textbox.Body.AddParagraph();
            Field field = pageNumber.AppendField("page number", FieldType.FieldPage);
            field.CharacterFormat.FontSize = 10;
           
            document.SaveToFile("sample.docx",FileFormat.Docx);
            System.Diagnostics.Process.Start("sample.docx");


Best wishes and have a nice day,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Fri Jan 31, 2014 9:39 am

Hello,

Have your issue been resolved?
Thanks for your feedback.


Best wishes,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc