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 Oct 08, 2013 10:31 am

Dear Spire,

I found a bug in the spire.doc-library. I am using spire office version 2.5.10.
When adding a newline as first character and adding that to cell, i recieve the following error:

at System.String.Remove(Int32 startIndex)
at sprើ.ᜂ(ParagraphBase A_0)
at sprើ.ᜈ(ParagraphBase A_0)
at sprើ.ᜀ(ParagraphItemCollection A_0)
at sprើ.ᜀ(Paragraph A_0, Boolean A_1)
at sprើ.ᜀ(BodyRegion A_0, Boolean A_1)
at sprើ.ᜃ(TableCell A_0)
at sprើ.ᜀ(CellCollection A_0)
at sprើ.ᜀ(TableRow A_0, Boolean A_1, Boolean A_2)
at sprើ.ᜀ(RowCollection A_0)
at sprើ.ᜅ(Table A_0)
at sprើ.ᜀ(BodyRegion A_0, Boolean A_1)
at sprើ.ᜀ(BodyRegionCollection A_0, Boolean A_1)
at sprើ.ᜇ(Section A_0)
at sprើ.ᜢ()
at sprើ.ᜬ()
at sprើ.ᜀ(Stream A_0, Document A_1)
at sprើ.ᜀ(String A_0, Document A_1)
at Spire.Doc.Document.ᜈ(String A_0)
at Spire.Doc.Document.SaveToFile(String fileName, FileFormat fileFormat)
at SpireBug.Program.CreateDetailedDocument(String filename) in c:\users\jslots\documents\visual studio 2010\Projects\SpireBug\SpireBug\Program.cs:line 33
at SpireBug.Program.Main(String[] args) in c:\users\jslots\documents\visual studio 2010\Projects\SpireBug\SpireBug\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


I removed all unnecessary code so this is the only code with which i can reproduce the problem.

Code: Select all
class Program
    {
       
        static void Main(string[] args)
        {
            Spire.License.LicenseProvider.SetLicenseFileName("license.elic.xml");
            CreateDetailedDocument(@"C:\temp\test.docx");
        }
     
        private static void CreateDetailedDocument(string filename)
        {
            Document d = new Document();
            Section section1 = CreateSection(d);

            Table table = section1.AddTable(false);
            TableRow tr = table.AddRow(2);
            string value = "\nvalue";
            string key = "colname";
            tr.Cells[0].AddParagraph().AppendText(key);
            tr.Cells[1].AddParagraph().AppendText(value ?? " ");
            d.SaveToFile(filename, FileFormat.Docx2010);
        }

        private static Section CreateSection(Document d)
        {
            if (d == null) return null;
            Section section1 = d.AddSection();
           
            section1.PageSetup.PageSize =PageSize.A4;
            section1.PageSetup.Orientation = PageOrientation.Portrait;
            return section1;
        }
    }



Can you try to reproduce this issue?

Thanks in advance,

Johan

jslots
 
Posts: 48
Joined: Mon Jul 09, 2012 12:03 pm

Wed Oct 09, 2013 3:39 am

Dear Johan,

Thanks for your feedback.
The issue has been reproduced, which has been transferred to our Dev team, once there are any progress from them, we will get it back to you immediately. Sorry for inconvenience.
If there are any questions, welcome to get it back to us.
Thanks And Regards,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Mon Oct 14, 2013 2:44 am

Hello Johan,

The issue has been resolved, and we will release a new hotfix of Spire.Office. Once it is released, we will inform you immediately.
If there are any questions, welcome to get it back to us.
Thanks And Regards,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Thu Oct 24, 2013 6:50 am

Hello Johan,

We have released the new hotfix of Spire.Office, please download and test the Spire.Office2.6.5 from http://www.e-iceblue.com/Download/downl ... t-now.html.

If there are any questions, welcome to get it back to us.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Nov 06, 2013 7:57 am

Dear Spire,

This issue is solved. Thanks for fixing this bug.

Johan

jslots
 
Posts: 48
Joined: Mon Jul 09, 2012 12:03 pm

Wed Nov 06, 2013 1:25 pm

The new version (Office 2.6.5) introduced a new problem to me.
When adding the same table to a document, then the alignment inside the table is changed when i compare this to version 2.5.10 (my previous version)

spire.jpg


Can you please fix this issue?

Johan

jslots
 
Posts: 48
Joined: Mon Jul 09, 2012 12:03 pm

Thu Nov 07, 2013 3:19 am

Hello,
Thanks for your feedback.
We have tested with the code(as below) provided by you in previous issue, but sorry that we don't reproduce the issue you experienced(see screenshots), and the generated documents is in the attachment. Could you please provide your test code if convenience?
Code: Select all
class Program
    {

        static void Main(string[] args)
        {
           
            CreateDetailedDocument(@"..\..\test2-5-10.docx");
        }

        private static void CreateDetailedDocument(string filename)
        {
            Document d = new Document();
            Section section1 = CreateSection(d);
            Paragraph para = section1.AddParagraph();
            para.AppendText("office2.5.10");
            Table table = section1.AddTable(false);
            TableRow tr = table.AddRow(2);
            string value = "value";
            string key = "colname";
            tr.Cells[0].AddParagraph().AppendText(key);
            tr.Cells[1].AddParagraph().AppendText(value ?? " ");
            d.SaveToFile(filename, FileFormat.Docx2010);
        }

        private static Section CreateSection(Document d)
        {
            if (d == null) return null;
            Section section1 = d.AddSection();

            section1.PageSetup.PageSize = PageSize.A4;
            section1.PageSetup.Orientation = PageOrientation.Portrait;
            return section1;
        }
    }

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Thu Nov 07, 2013 6:29 am

Hi Gary,

I forgot to notice that this result is shown when saving the documents as PDF.
The Docx documents are working correctly.

Im sorry for the inconvenience,
Johan

jslots
 
Posts: 48
Joined: Mon Jul 09, 2012 12:03 pm

Fri Nov 08, 2013 3:27 am

Hi Johan,

Thanks for your information.

We have reproduced the issue, which has been transferred to our Dev team, once there are any progress from them, we will get it back to you immediately. Sorry for inconvenience.

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Nov 13, 2013 6:22 am

Hello Johan,

The issue has been resolved, and our test team is testing the newest hotfix, once it works fine, we will release it and inform you immediately.

If there are any questions, welcome to get it back to us.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Nov 26, 2013 6:49 am

Hello Johan,

The newest hotfix of Spire.Office has been released, you could download Spire.Office2.6.6 form the following link and test the issue.
http://www.e-iceblue.com/Download/downl ... t-now.html

If there are any questions, welcome to get it back to us.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Fri Jan 31, 2014 10:04 am

Dear Spire,

It took me a while to finish another project before i could test this new version. Finally, i tested the new version today and it works ok. Thanks for this fix!

I found another small bug when testing the new version, which was already present in the previous versions.

When adding a footer to the PDF-document with pagenumbers there is something going wrong with the styling of the pagenumber:

Code: Select all
internal class Program
    {
        private static Font font = new Font("Calibri", 9, FontStyle.Regular);
        private static Font titleFont = new Font("Calibri", 9, FontStyle.Bold);
        private static Font footerFont = new Font("Calibri", 9, FontStyle.Regular);


        private static void Main(string[] args)
        {
            Spire.License.LicenseProvider.SetLicenseFileName("license.elic.xml");
            CreateDetailedDocument(@"C:\temp\test2.pdf");
        }

        private static void CreateDetailedDocument(string filename)
        {
            Document d = new Document();
            Section section1 = CreateSection(d);
            InsertFooter(section1);
            Table table = section1.AddTable(true);
            TableRow tr = table.AddRow(2);
            string value = "value";
            string key = "colname";
            TextRange t = tr.Cells[0].AddParagraph().AppendText(key);
            t.CharacterFormat.Font = titleFont;
            TextRange t2 = tr.Cells[1].AddParagraph().AppendText(value ?? " ");
            t2.CharacterFormat.Font = font;

            d.SaveToFile(filename, FileFormat.PDF);
        }

        private static Section CreateSection(Document d)
        {
            if (d == null) return null;
            Section section1 = d.AddSection();

            section1.PageSetup.PageSize = PageSize.A4;
            section1.PageSetup.Orientation = PageOrientation.Portrait;
            return section1;
        }


        private static void InsertFooter(Section section)
        {
            HeaderFooter footer = section.HeadersFooters.Footer;
            List<TextRange> textRanges = new List<TextRange>();

            Table t = footer.AddTable(false);
            TableRow tr1 = t.AddRow(3);
            TableRow tr2 = t.AddRow(3);

            float f = (section.PageSetup.ClientWidth) / 3;
            tr1.Cells[0].Width = f;
            tr1.Cells[1].Width = f;
            tr1.Cells[2].Width = f;
            tr2.Cells[0].Width = f;
            tr2.Cells[1].Width = f;
            tr2.Cells[2].Width = f;

            tr1.RowFormat.Borders.BorderType = BorderStyle.None;
            tr2.RowFormat.Borders.Left.BorderType = BorderStyle.None;
            tr2.RowFormat.Borders.Right.BorderType = BorderStyle.None;
            tr2.RowFormat.Borders.Bottom.BorderType = BorderStyle.None;
            tr2.RowFormat.Borders.Top.BorderType = BorderStyle.Single;

            //insert pagenumber in footer
            Paragraph footerParagraphRight = tr2.Cells[2].AddParagraph();
            textRanges.Add(footerParagraphRight.AppendField("page number", FieldType.FieldPage));
            textRanges.Add(footerParagraphRight.AppendText(" of "));
            textRanges.Add(footerParagraphRight.AppendField("number of pages", FieldType.FieldNumPages));
            footerParagraphRight.Format.HorizontalAlignment = HorizontalAlignment.Right;

            foreach (TextRange range in textRanges)
            {
                range.CharacterFormat.Font = footerFont;
            }
        }
    }


as you can see i format all the textranges with a footerfont, but when i create the document, every text in the footer is styled, except the pagenumber. The pagenumber has the default style and is too large in this example.

capture_01312014_105903.jpg


Can you try to reproduce this?

Thanks in advance,
Johan

jslots
 
Posts: 48
Joined: Mon Jul 09, 2012 12:03 pm

Mon Feb 03, 2014 6:51 am

Hello Johan,

Thanks for you feedback. We have reproduced this problem, sorry for this inconvenience.
We have posted it to our dev team. After it fixed, we will inform you immediately.
Now it is Chinese New Year holiday here. We will get back to work on Feb.7. We will inform you immediately as soon as there is any update on the feature from our dev team. Thanks for your understanding and cooperation.

Regards,
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar

harry.support
 
Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm

Sat Feb 08, 2014 9:17 am

Dear Johan,

I am writing to tell you that the issue has been fixed. We will build a new version. After the version passes all test cases, we will release it and inform you.

Best wishes,
Amy
E-iceblue support team
User avatar

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

Fri Feb 28, 2014 9:57 am

Dear Johan,

Thanks for your waiting.
The new version of Spire.Office has been released. Welcome to download and test Spire.Office Platinum (Hot Fix) 2.7.2(http://www.e-iceblue.com/Download/downl ... t-now.html).

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