Free Support Forum - aspose.com

Alignement of Picture in header when exporting to PDF

Hi

I use this code to add a jpeg image to my header:

With pSheet.PageSetup<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

.SetHeader(0, pLeft)

.SetHeader(1, pCenter)

.SetHeader(2, pRight)

If pLogoSection > enuHeaderSections.None Then

Dim strLogoURI As String = Application.StartupPath + "\test.JPG"

If Not IO.File.Exists(strLogoURI) Then

Throw New Exception("Cannot get image >>\test.JPG<<")

End If

Dim inFile As IO.FileStream

inFile = New System.IO.FileStream(strLogoURI, System.IO.FileMode.Open, System.IO.FileAccess.Read)

Dim binaryData(Convert.ToInt32(inFile.Length)) As Byte

Dim bytesRead As Int32 = inFile.Read(binaryData, 0, Convert.ToInt32(inFile.Length))

.SetHeaderPicture(pLogoSection, binaryData)

.SetHeader(pLogoSection, "&G") 'Image script

End If

End With

When I pass the parameters to have it in the center section, it appears perfectly centered when I save the report as an Excel file. When I save the same report as a PDF file, the picture is not centered.

Any idea why? I have attached the XML file for you to test.

Hi,

Which version of Aspose.Cells and Aspose.Pdf you are using . Kindly try the latest versions of Aspose.Cells (4.4.1.9 : you may download it from the thread: http://www.aspose.com/community/forums/thread/117571.aspx) and (3.6.2). If you still find the problem, please do post your saved excel file and output pdf file. We will check it soon.

Thank you.

Hi

I am already using Aspose.Cells 4.4.1.9 and Aspose.Pdf 3.6.2.1 because other problems problems were fixed

Hi

I thought that this problem was already fixed but apparantely it isn't!

I am now using Aspose.Cells version 4.4.3.4.

Any (good) news for me?

Hi,

Could you post your saved excel and output .pdf files We will check it soon.

Thank you.

here are the requested files.

if you preview the excel file, you see that the image in the header is correctly centered.

in the PDF version, it is too far to the left.

Hi,

We are working on this issue.Thanks for your patience.

In Ms Excel, if the width of center section in the header is more than 1/3 of the page width, the text will auto expand to left and right section, even they can overlap others. But Pdf coud not implement it.

We are looking how to do as Excel with Pdf.The error of the current version is caused by we try to adjust the width of the section.

Hi,

Please try this fix.

In the current version, we will calculate the width of the center section of the page header/footer,then set the width of each column.

But we still do not support a section overlap other section.

I made a few quick tests and logos are centered. Thanks.