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.

Mon Jul 09, 2012 12:45 pm

Dear Iceblue,

I am seriously considering to buy some products, but there are some issues i am having with the free trial version. I use version 4.4.
First of all my code:
Code: Select all
Document document = new Document();
Section s = document.AddSection();

s.PageSetup.PageSize = PageSize.A3;
s.PageSetup.Orientation = PageOrientation.Landscape;

InsertHeaderAndFooter(s);

Paragraph paragraph = s.AddParagraph();
paragraph.Text = "Test1";

Table t = s.AddTable();
TableRow r = t.AddRow(2);
TextRange tr = r.Cells[0].AddParagraph().AppendText("test");
tr.CharacterFormat.FontName = "comic sans ms";

//add image to 2nd column
TableCell c = r.Cells[1];
c.Width = 400F;
Paragraph p = c.AddParagraph();
p.AppendPicture(new Bitmap(@"C:\temp\image1.jpg"));

document.SaveToFile(@"C:\temp\test.docx", FileFormat.Docx2010);
document.SaveToFile(@"c:\temp\sample1.pdf", FileFormat.PDF);


Issue 1)
This code first add's text to the document and after that, a table.
In the second cell of the first row, i have set width of the cell to 400F, and added a picture.
Image
In the result (Capture0001) you can see that the image is added to the second cell, but the size of the cell is set to the first cell.

When i save this document as PDF, there are several problems:
Issue 2)
The layout of the PDF is different: The first text-paragraph is placed inside the header area. In the word-document it is placed beneath this area.
Issue3)
The 1 page word-document is saved as a 2 page PDF document, with an empty second page (only headers/footers are included)
Issue3)
The table included in the word-document is not converted to the pdf.

See Capture0002
Image

Are these issues bugs, or am i doing something wrong?

Thanks in advance,
Johan
You do not have the required permissions to view the files attached to this post.

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

Tue Jul 10, 2012 2:44 am

Hi jslots,

About your problem, I am testing it. I will give you a reply as soon as possible. Thank you for your cooperation and understanding.
Nancy
e-iceblue support team
contact: nancy.wang@e-iceblue.com
User avatar

nancy
 
Posts: 51
Joined: Wed May 30, 2012 2:02 am

Tue Jul 10, 2012 3:10 am

Hi jslots,

About your problem, I have tested it. But I can't reproduce it. It is my test codes and files generated in the attachment. You can refer to it. If you still have problem, please let us know more information! Thank you for your cooperation and understanding.
You do not have the required permissions to view the files attached to this post.
Nancy
e-iceblue support team
contact: nancy.wang@e-iceblue.com
User avatar

nancy
 
Posts: 51
Joined: Wed May 30, 2012 2:02 am

Tue Jul 10, 2012 7:35 am

Hi nancy,

Thanks for you quick answer.
With your code it looks a little better, as the table is exported to the pdf (without borders). Is is possible to get the borders also in the pdf?

When i add my header and footer section there's something going wrong with the layout in de pdf.

I didn't posted the code for that in my first post, my bad!

here is the code i use for adding the header and footer section:

Code: Select all
private static void InsertHeaderAndFooter(Section section)
{
            HeaderFooter header = section.HeadersFooters.Header;
            HeaderFooter footer = section.HeadersFooters.Footer;

            //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(Image.FromFile(@"c:\temp\image1.jpg"));
            headerPicture.TextWrappingStyle = TextWrappingStyle.Square;
            headerPicture.HorizontalOrigin = HorizontalOrigin.Page;
            headerPicture.HorizontalAlignment = ShapeHorizontalAlignment.Right;
            headerPicture.VerticalOrigin = VerticalOrigin.Page;
            headerPicture.VerticalAlignment = ShapeVerticalAlignment.Top;

            //insert pagenumber in footer
            Paragraph footerParagraph = footer.AddParagraph();
            footerParagraph.AppendField("page number", FieldType.FieldPage);
            footerParagraph.AppendText(" of ");
            footerParagraph.AppendField("number of pages", FieldType.FieldNumPages);
            footerParagraph.Format.HorizontalAlignment = HorizontalAlignment.Right;
            footerParagraph.Format.Borders.Top.BorderType  = BorderStyle.Single;
 }


my goal is to set some text in the header at the left side and set a picture in the right side of the header (it would be nice if they are placed at the same height)
As you can see, everything looks fine in the word-document:
Image

But saving the file as pdf is giving me some difficulties:
Image

Can you reproduce this?
And even more important: Do you have a solution for this?

Thanks in advance,
Johan
You do not have the required permissions to view the files attached to this post.

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

Tue Jul 10, 2012 9:15 am

Hi jslots,

About your problem, we have reproduced it. We have defined it as a bug and we are solving it. We will inform you once we fix it. Thank you for your cooperation and understanding.
Nancy
e-iceblue support team
contact: nancy.wang@e-iceblue.com
User avatar

nancy
 
Posts: 51
Joined: Wed May 30, 2012 2:02 am

Tue Jul 10, 2012 12:53 pm

Hi Nancy,

Thanks for your reply.

Did you noticed my first question about converting the table-borders from word to pdf? Do you work on that also?
All i want to do is creating 2 identical documents in .doc and .pdf.
Do you have any idea when it will be fixed? are we talking about days, weeks, months?

Awaiting your reply,
Johan

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

Fri Jul 13, 2012 2:08 am

Hi jslots,

About your problem, we have solved it. We will update it in next version. You will be informed immediately once new version is released. Thank you for your cooperation and understanding. If you have any problems, welcome to contact us!
Nancy
e-iceblue support team
contact: nancy.wang@e-iceblue.com
User avatar

nancy
 
Posts: 51
Joined: Wed May 30, 2012 2:02 am

Tue Jul 17, 2012 8:01 am

Hi jslots,

Thanks for your patience and so sorry for the long-time waiting.
The issue you reported is already resolved. Please download the latest hot fix (spire.doc_hotfix_4.4.2) here (http://www.e-iceblue.com/Download/download-word-for-net-now.html).

Please feel free to contact us if you have any questions and requests.

Amy
e-iceblue support
User avatar

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

Tue Jul 17, 2012 9:07 am

Hi Iceblue,

Unfortunately, when i try to download hotfix version 4.4.2 there is something going wrong.
When i click on the downloadlink it is pointing at: http://www.e-iceblue.com/Download/download-word-for-net-now/spiredoc-pack-hot-fix442/Download.html, but the file i am downloading from your server is: spire.doc_hotfix_4.3.6.zip.

In this file my problem is not fixed. Can you please make the 4.4.2 hotfix package available?

Thank you very much for the quick fix.
Johan

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

Tue Jul 17, 2012 10:10 am

Hi Johan,

We have fix the error, sorry for that.
Please download the hotfix again from http://www.e-iceblue.com/Download/download-word-for-net-now.html.
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar

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

Tue Jul 17, 2012 11:11 am

Thank you very much for this fix. It's working correctly right now. Great!

Only thing that isn't fixed is converting the table-borders to pdf. In previous posts i mentioned this already. In the previous added attachments you can see there are no borders in pdf.

Is it possible to fix this also?

Thanks in advance,
Johan

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

Tue Jul 17, 2012 2:21 pm

Dear e-iceblue,

There are still some issues i am struggling with:

1) I align the image in the header like this:
Code: Select all
 DocPicture headerPicture = headerParagraph.AppendPicture(Image.FromFile(@"c:\temp\image1.jpg"));
headerPicture.HorizontalOrigin = HorizontalOrigin.Page;
headerPicture.HorizontalAlignment = ShapeHorizontalAlignment.Right;
headerPicture.VerticalOrigin = VerticalOrigin.Page;
headerPicture.VerticalAlignment = ShapeVerticalAlignment.Top;


The document looks like the upper part of the image, and the print preview looks like the bottom part of the image.
Doc Printpreview.PNG



The image is placed outside the printmargins of the page.
Then i tried to place the image in a different Origin:
Code: Select all
DocPicture headerPicture = headerParagraph.AppendPicture(Image.FromFile(@"c:\temp\image1.jpg"));
headerPicture.HorizontalOrigin = HorizontalOrigin.Margin;
headerPicture.HorizontalAlignment = ShapeHorizontalAlignment.Right;
headerPicture.VerticalOrigin = VerticalOrigin.Margin;
headerPicture.VerticalAlignment = ShapeVerticalAlignment.Top;


This results for the word document to place the image beneath the header:
origin margin.png


As you can see the image is placed below the header in the document. Saving the file as a PDF document results in an unexpected position of the image.
The image is placed partly on the page, and partly outside the page. This is just to let you know there is something wrong converting to PDF, as i want the image inside the header.

Then i tried absolute positioning like the code below:

Code: Select all
DocPicture headerPicture = headerParagraph.AppendPicture(Image.FromFile(@"c:\temp\image1.jpg"));
headerPicture.TextWrappingStyle = TextWrappingStyle.Square;
headerPicture.HorizontalPosition = section.PageSetup.PageSize.Width - 150f;
headerPicture.VerticalPosition = -30f;


This results in the next 2 documents:
Absolute positioning.png


As you can see the image is placed nicely in the word-document but when saving it to PDF the image is placed partly outside the document like i mentioned before.

Can you reproduce these issues? Do you have a solution to place the image inside the printmargins, inside the header, in DOC and PDF?

If you need more information, please let me know.
Johan
You do not have the required permissions to view the files attached to this post.

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

Wed Jul 18, 2012 7:02 am

Hi jslots,

I am so sorry for the inconvenience caused by us .
#1."Only thing that isn't fixed is converting the table-borders to pdf,Is it possible to fix this also? "

We have reproduced the issue and created a research on it, but we need some more time to fix it.You will be informed immediately once we have fixed.

#2."Can you reproduce these issues? Do you have a solution to place the image inside the printmargins, inside the header, in DOC and PDF?"

I do a demo according to your code, but I can't reproduce the issue you met.I will give you the demo in the attachment.PLease check it.
If you have any problems, please contact us.

Amy
e-iceblue support
You do not have the required permissions to view the files attached to this post.
User avatar

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

Wed Jul 18, 2012 7:15 am

Hi Amy,

Thanks for trying to fix the border issue.
When i open the attachment you gave me, i have the same problem with the print-preview of the word-document. The image is placed outside the printmargins of the paper.
Can you please check the print preview of the word document if you have the same problem?


Thanks in advance,
Johan

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

Wed Jul 18, 2012 9:51 am

Hi jslots,

We have researched it and confirmed it was a problem.I am sorry for that .I change a part of the code:
Code: Select all
         //header picture on right top of the page.
            DocPicture headerPicture = headerParagraph.AppendPicture(Image.FromFile(@"..\..\hand.png"));
            headerPicture.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
            headerPicture.HorizontalOrigin = HorizontalOrigin.Margin;
            headerPicture.HorizontalAlignment = ShapeHorizontalAlignment.Right;
            headerPicture.VerticalOrigin = VerticalOrigin.Page;
            headerPicture.VerticalAlignment = ShapeVerticalAlignment.Inside;

It is saved doc file is ok, but saved pdf file that the image disappears.We need more time to fix it .Once we have fixed it ,will let you konw immediately.
Thanks for your underdtanding .

Amy
e-iceblue support
User avatar

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

Return to Spire.Doc