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.

Fri Aug 03, 2012 10:41 am

Hi jslots,
We have fixed your problem, please download the new hotfix of spire.doc v4.4.5 from http://www.e-iceblue.com/Download/download-word-for-net-now.html.
Sorry for the delay.
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar

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

Mon Aug 13, 2012 1:47 pm

Dear Iceblue,


1) The issue with the dissappearing of the image when saving to PDF is still not solved. :-( (using spire.office version 2.3.2, but also tried spire.doc 4.4.10 and 4.4.6). I added my code below so you can check my code, or try to reproduce the issue.
2) As mentioned previously, there are no table borders exported when the document is saved in PDF. You told me that you needed more time to investigate. Are you still working on this issue?
3) when i add a table to the worddocument (using the latest spire.office release), i want to set the cell-width. When i set the cell-width this is not visible in the word-document. The cell is just fitted to the text thats inside.
When i save the same document as PDF, i can see the cell-width is set to cell. It is just not applied when i save it to .docx.

here is my code:


Code: Select all
 
// first added some code to set licensekey. just not added to this post.

//new document and set PageSetup
            Document document1 = new Document();
            Section section1 = document1.AddSection();
            section1.PageSetup.PageSize = PageSize.A3;
            section1.PageSetup.Orientation = PageOrientation.Landscape;

             InsertHeaderAndFooter(section1);

            // add paragraph1
            Paragraph paragraph1 = section1.AddParagraph();
            paragraph1.Text = "Test1";

            // add table and add content
            Table table1 = section1.AddTable();
            TableRow tableRow1 = table1.AddRow(2);
            TextRange textRange1 = tableRow1.Cells[0].AddParagraph().AppendText("text");
            tableRow1.Cells[0].Width = 100f;
            textRange1.CharacterFormat.FontName = "comic sans ms";

            //add image to 2nd column of table
            TableCell tableCell1 = tableRow1.Cells[1];
            tableCell1.Width = 500f;
            Paragraph paragraph2 = tableCell1.AddParagraph();
            paragraph2.AppendPicture(new Bitmap(@"c:\temp\\image1.jpg"));

           
            //dummy code to add some pages
            section1 = document1.AddSection();
            section1.AddParagraph().AppendText("1");
            section1 = document1.AddSection();
            section1.AddParagraph().AppendText("2");
         section1 = document1.AddSection();
            section1.AddParagraph().AppendText("3");


            // save
            document1.SaveToFile(@"c:\temp\test.docx", FileFormat.Docx2010);
            document1.SaveToFile(@"c:\temp\test.pdf", FileFormat.PDF);

        }


        private static void InsertHeaderAndFooter(Section section)
        {
            HeaderFooter header1 = section.HeadersFooters.Header;
            HeaderFooter footer = section.HeadersFooters.Footer;
            InsertHeader(header1);

            //insert pagenumber in footer
            Paragraph footerParagraphRight = footer.AddParagraph();
            footerParagraphRight.AppendField("page number", FieldType.FieldPage);
            footerParagraphRight.AppendText(" van ");
            footerParagraphRight.AppendField("number of pages", FieldType.FieldNumPages);
            footerParagraphRight.Format.HorizontalAlignment = HorizontalAlignment.Right;

        }

        private static void InsertHeader(HeaderFooter header)
        {
            //insert picture and text to header
            Paragraph headerParagraph = header.AddParagraph();

            //border
            headerParagraph.Format.Borders.Bottom.BorderType = BorderStyle.Single;

            //Fill header with text
            TextRange text = headerParagraph.AppendText("Headertext");
            text.CharacterFormat.FontName = "Arial";
            text.CharacterFormat.FontSize = 14f;
            text.CharacterFormat.Italic = true;
            headerParagraph.Format.HorizontalAlignment = HorizontalAlignment.Left;

            //header picture on right top of the page.
            DocPicture headerPicture = headerParagraph.AppendPicture(new Bitmap(@"C:\temp\image1.jpg"));

            headerPicture.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
            headerPicture.HorizontalOrigin = HorizontalOrigin.Margin;
            headerPicture.HorizontalAlignment = ShapeHorizontalAlignment.Right;
            headerPicture.VerticalOrigin = VerticalOrigin.Page;
            headerPicture.VerticalAlignment = ShapeVerticalAlignment.Inside;
        }


Is this a bug, or is there something wrong with my code?

4) As you can see in previous codeblock, i add a headerimage to every page in the document. When saved as Word-document the image is placed in the footer in every even pagenumber in stead of the header. Can you reproduce that?



I'm looking forward to your answer,
Johan

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

Tue Aug 14, 2012 5:51 am

Hi jslots,

Please dont mind that I add the answers after your problems.

#2) As mentioned previously, there are no table borders exported when the document is saved in PDF......

Please change "Table table1 = section1.AddTable();" for " Table table1 = section1.AddTable(true);"

#4) As you can see in previous codeblock, i add a headerimage to every page in the document......

Please change "headerPicture.VerticalAlignment = ShapeVerticalAlignment.Inside;" for "headerPicture.VerticalAlignment = ShapeVerticalAlignment.Top;"

#1) and #3), we will give you the solution later. Please wait some time. Thanks.

Best wishes.
Amy
e-iceblue support
User avatar

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

Tue Aug 14, 2012 7:00 am

Hi amy,

Unfortunately, your solution for #4 is not an option. On every EVEN page (pagenumber 2, 4, 6 etc) the image is placed inside this footer in stead of the header. Also i need to use ShapeVerticalAlignment.Inside because of a problem with the print preview of the worddocument. When i use you solution the image is placed outside the printmargins of the page (you can watch that when clicking print preview in the document). This was a problem i mentioned earlier in this topic. The use of ShapeVerticalAlignment.Inside was a solution for that problem. :-)

I am currently testing your solution for #2.

Regards,
Johan

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

Tue Aug 14, 2012 9:30 am

Hi jslots,

The solution for #2 is ok?

For #4, please change "headerPicture.VerticalAlignment = ShapeVerticalAlignment.Inside;" for "headerPicture.VerticalPosition = section.PageSetup.Margins.Top;". If you still have the problem, please let us know.

For #1 and #3, we need some time to fix them and mybe give you the solutions this week. However, we will inform you immediately once them have been fixed.

Best wishes.
Amy
e-iceblue support
User avatar

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

Tue Aug 14, 2012 12:20 pm

Hi Amy,

The solution you offered for #4 is ok for the WordDocument. Thanks for that. Just 1 thing: the position of the image in the pdf file is not really nice. It is placed on the outside of the document, while the image in the worddocument is placed a little more to the innerside of the document. (see attachments for the differences)

But the solution for #2 is not working. I just noticed that there is no table exported at all. Its not only the borders, but the whole table including the data is missing.
I added 2 documents where you can see the difference. 1 is saved as docx, the other as pdf.

the worddocument
doc.jpg


and the pdf:
pdf.jpg


As you can see, the worddocument consists of 6 pages (i just blurred some information)
The Worddocument is beginning to meet my expectations, besides the issues you are working on. You are making good improvements. :-)
The PDF is far away from that.

When i save the document as PDF there is no table exported at all. Its not only borders, but also data an the table itself that is not showing up in the pdf document. There is only 1 page in the pdf document.
Can you please investigate why there is no table exported to the PDF? Can you reproduce this issue? I am still using spire.office pack version 2.3.2.

If you need additional information please ask!

Thanks in advance.
Johan

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

Wed Aug 15, 2012 3:21 am

Hi jslots,

For "the position of the image in the pdf file is not really nice.", we have reproduced the problem and created a research on it. Once it has been fixed, we will inform you immediately.

For"Its not only the borders, but the whole table including the data is missing." , I am sorry that we have not reproduced your problem because we have not your document and dont know your table format is what. I do a demo test the problem for no table boders in pdf, the reslut pdf has table boders. Please check the attachment.

Could you provide more information(for example, a similar document ) about your problem for us? Thanks.

Best wishes.
Amy
e-iceblue support
User avatar

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

Wed Aug 15, 2012 8:05 am

Hi Amy,

I found the problem with exporting tables to PDF. When a cell has no width, the cell is not exported to PDF.
When i add a width to all cells, the whole table is exported including the widths. The widths are not having any effect on the cell in the word-document(thats why i didnt add the widths), but you are trying to fix that one.

With kind regards,
Johan

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

Wed Aug 15, 2012 9:11 am

Hi jslots,

Thank you discovered these problems.

For "When a cell has no width, the cell is not exported to PDF.", we have reproduced the problem.
For "The widths are not having any effect on the cell in the word-document", we are trying to fix.

If you discover the other problems, please let us know. We will fix them together, but the time will be longer. We mybe give all solutions within this week or next week.

Best wishes. :)
Amy
e-iceblue support
User avatar

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

Fri Aug 24, 2012 9:12 am

Hi jslots,

Thanks for your patience and so sorry for the long-time waiting.
The problems "The widths are not having any effect on the cell in the word-document" and "doc to pdf ,the header pic is incomplete." have been fixed. Please download the latest hot fix Spire.Office(v2.3.5 ) here(http://www.e-iceblue.com/Download/download-office-for-net-now.html).
If you hava any problems, please feel free to contact us.

Best wishes.
Amy
e-iceblue support
User avatar

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

Fri Aug 24, 2012 10:08 am

Hi Amy,

Thanks for fixing this one. It's working! Great job.

I have another issue thats not working as it should be. When i add a table to the footersection of the document (Table t = footer.AddTable(false);) the table is diplayed with border. When i save the document as PDF its working as expected.SO the problem is only in the Word-document.

Code: Select all
 HeaderFooter footer = section.HeadersFooters.Footer;
            Table t = footer.AddTable(false);
            TableRow tr1 = t.AddRow(2);
            TableRow tr2 = t.AddRow(2);
           
            float f = (section.PageSetup.ClientWidth ) / 2;
            tr1.Cells[0].Width = f;
            tr1.Cells[1].Width = f;
            tr2.Cells[0].Width = f;
            tr2.Cells[1].Width = f;
           
            tr2.RowFormat.Borders.Top.BorderType = BorderStyle.Single;
           
            //insert datetime in footer
            Paragraph footerParagraphLeft = tr2.Cells[0].AddParagraph();
            footerParagraphLeft.Format.HorizontalAlignment = HorizontalAlignment.Left;
            footerParagraphLeft.AppendText(DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss"));

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

 


Can you do some research and try to reproduce this?
Thats probably the last issue, because my document-format is almost ready. :-)

Johan

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

Mon Aug 27, 2012 9:20 am

Hi Johan,

I have reproduced your problem. We hava defined it as a bug. Once it has been fixed, we will inform you immediately.

Best wishes.
Amy
e-iceblue support
User avatar

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

Wed Sep 05, 2012 10:37 am

Dear Johan,

Thanks for you waiting.

The bug when add a table to the footersection of the document (Table t = footer.AddTable(false);) and then the table is diplayed with border in the result word-doucumet has been fixed, please download Spire.Doc Pack (Hot Fix) Version:4.4.24 from the link http://www.e-iceblue.com/Download/download-word-for-net-now.html.

If you have any problems, please feel free to contact us.

Amy
e-iceblue support
User avatar

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

Wed Sep 05, 2012 11:11 am

Hi Amy,

Thanks for making this available, but when will the Office pack be available with this fix?


Johan

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

Thu Sep 06, 2012 2:06 am

Dear Johan,

We are sorry that inconvenience caused by us.
The hotfix of Office pack is available with this fix will be released today or tomorrow. However, once it has been released, we will inform you immediately.

Best wishes,
Amy
e-iceblue support
User avatar

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

Return to Spire.Doc