Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Fri Aug 30, 2019 8:29 am

Hi

I have two problems :
    -Is there a possibility to add a shadow on a shape and the possibility to change the round of a round rectangle ?
    -When i add a page number which is not in a footer, it's not updated when i open the document. Btw changing the boolean "IsUpdateFields" to true solved the problem for the update of the total number of pages of the document.
You do not have the required permissions to view the files attached to this post.

thbryer
 
Posts: 10
Joined: Wed Apr 24, 2019 6:33 am

Fri Aug 30, 2019 10:17 am

Hi,

Thanks for your inquiry.
1. To help us investigate accurately, could you please provide your desired Word file?
2. The code "doc.IsUpdateFields = true" could update fields. So please use this to solve your issue. If you still have the issue, please provide your input file and the full code for testing.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Fri Aug 30, 2019 1:22 pm

In the file theres is two documents : one for round rectangles and one for the wanted results of page numbers.

This is my code for page number :
Code: Select all
static void Main(string[] args)
        {
            string docWord = @"C:\Users\thb\Desktop\testNumPage.docx";                             // TO MODIFY
            SPI.Document doc = new SPI.Document();
            SPI.Section section = doc.AddSection();
            SPI.Documents.Paragraph para = section.AddParagraph();
            para.AppendText("Page ");
            para.AppendField("NumPage", SPI.FieldType.FieldPage);
            para.AppendText("/");
            para.AppendField("NumTotPages", SPI.FieldType.FieldNumPages);
            para.ApplyStyle(SPI.Documents.BuiltinStyle.Normal);
            doc.IsUpdateFields = true;
            doc.SaveToFile(docWord);
        }


Be sure to select all the text after the creation of the document and then update fields.
You do not have the required permissions to view the files attached to this post.

thbryer
 
Posts: 10
Joined: Wed Apr 24, 2019 6:33 am

Mon Sep 02, 2019 3:21 am

Hi,

Thanks for your information.
1. Sorry that our products doesn't support the functions at present. We will consider adding the new feature in our future upgrade.
2. I have noticed the page number field was updated incorrectly, and I have logged it in our bug tracking system. We will let you know once there is any update.
Sorry for the inconvenience caused.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Sun Sep 29, 2019 9:20 am

Hi,

Glad to inform you the issue#2 (the page number field was updated incorrectly) has been resolved in Spire.Doc Pack(hot fix) Version:7.9.9.
Our website link: https://www.e-iceblue.com/Download/down ... t-now.html
NuGet link: https://www.nuget.org/packages/Spire.Doc/7.9.9

As for the issue#1, sorry that there is no update at present. If there is any news, we will let you know.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Mon Feb 17, 2020 9:31 am

Hi,
I am the new developer in charge of our project. I try the new version and it doesn't solve our issue #2.
Now, the page number doesn't display NUMPAGE but it display "2". It should display 1 as it is the first page of our section. If i refresh the page number in word, it changes the "2" by a "1".

asterakin
 
Posts: 3
Joined: Mon Apr 15, 2019 7:50 am

Mon Feb 17, 2020 10:14 am

Hi,

Thanks for your information.
After testing the issue#2 with the latest Spire.Doc Pack(hot fix) Version:8.2.9 and following code, I didn't notice there is any issues. The page number is correct. Attached is the result file on my side.
Code: Select all
            Document doc = new Document();
            Section section = doc.AddSection();
            Paragraph para = section.AddParagraph();
            para.AppendText("Page ");
            para.AppendField("NumPage", FieldType.FieldPage);
            para.AppendText("/");
            para.AppendField("NumTotPages", FieldType.FieldNumPages);
            para.ApplyStyle(BuiltinStyle.Normal);
            doc.IsUpdateFields = true;
            doc.SaveToFile("18752.docx", FileFormat.Docx);


Do you use the same code and version? If not, please share the code. If so, please tell us the OS and Region information(e.g. Win7 64bit, China/Chinese) for further investigation.

Sincerely,
Betsy
E-iceblue support team
You do not have the required permissions to view the files attached to this post.
User avatar

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

Thu Feb 27, 2020 9:08 am

I found how to reproduce the error, it happend in Textbox, here my code :
Code: Select all
Document doc = new Document();
            Section section = doc.AddSection();
            var para1 = section.AddParagraph();
            para1.AppendText("in the first section");
            para1.AppendBreak(BreakType.PageBreak);
            Section section2 = doc.AddSection();
            var para2 = section2.AddParagraph();
            para2.AppendText("in the second section");
           
            section2.PageSetup.DifferentFirstPageHeaderFooter = true;
            var footer = section2.HeadersFooters.FirstPageFooter;
            section2.PageSetup.RestartPageNumbering = true;
            section2.PageSetup.PageStartingNumber = 1;
           
            Paragraph para = footer.AddParagraph();
            var textbox = para2.AppendTextBox(600, 60);
            para2.AppendBreak(BreakType.PageBreak);
           
            TextRange textRange = new TextRange(doc);
            textRange.Text = "Incorrect Page number (should display 1 as I reset the starting page, it indeed show 1 if i refresh manually) :  ";
           
            textbox.Body.AddParagraph();
            textbox.Body.LastParagraph.ChildObjects.Add(textRange);
            textbox.Body.LastParagraph.AppendField("NumPage", FieldType.FieldPage);
           
           
            para.ApplyStyle(BuiltinStyle.Normal);
            doc.IsUpdateFields = true;
            doc.SaveToFile("test1.docx", FileFormat.Docx);

asterakin
 
Posts: 3
Joined: Mon Apr 15, 2019 7:50 am

Thu Feb 27, 2020 9:22 am

Hi,

Thanks for your code.
I have reproduced the issue and logged it in our bug tracking system with the ticket SPIREDOC-3974. We will let you know once it is fixed.
Apologize for the inconvenience caused.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Return to Spire.Doc