We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issues with header row in excel

Hi, i am trying to convert excel to pdf in aspose. There is a header row in my excel which i want to span across the complete width of the PDF but when i am resizing the excel while converting to pdf the header also gets resized having right and left margin.

Is there a way where i can make two rows of the excel to span through the complete width of the PDF without any margins left even when the excel sheet is resized.

Best,
Ishi

@dewan.ishi,

Thanks for providing us some details.

Could you provide us your template Excel file and output PDF file (by Aspose.Cells). Also provide your desired Excel file (you may modify in MS Excel (e.g using PageSetup or other options) manually and save the file) where the print preview of the sheet should show your desired display. Also provide your desired output PDF (if possible). We will check and help you on how to do it via Aspose.Cells APIs.

Hi Amjad,

PFA the excel the generated pdf and the desired pdf.files.zip (307.5 KB)

@dewan.ishi,

Thanks for the input and output Pdf files.

You did not provide your desired Excel file as requested:
“Also provide your desired Excel file (you may modify in MS Excel (e.g using PageSetup or other options) manually and save the file) where the print preview of the sheet should show your desired display”.

Once we have the Excel file, we will evaluate it thoroughly.

the desired and the input excel files are same… i want the change in PDF and dont want to change my excel file anyhow. Also, i want to all the excel files to look consistent so that all the PDF’s that are being generated look consistent.

@dewan.ishi,

Please note, Aspose.Cells is a spreadsheet management library rather than PDF engine, it cannot modify or change anything in the output PDF, the PDF file would be same and identical with the underlying Workbook (when taking print preview of the sheets in MS Excel manually). So, you have to modify or re-create your Excel file in accordance with your desired output so the output PDF should be generated accordingly. I could not find any option in Ms Excel to have different margins for first row only, the margins in Ms Excel are applied to the whole matrix/data or table. That’s why I requested you to provide your desired Excel file.

ok i just want the header of my excel file to span through the complete page of the pdf that is being generated. i dont want it to get set with the sheet margins that we use for excel.

@dewan.ishi,

I think there is no better way to accomplish the task. Open your Excel file into Ms Excel manually. First you will have to set the left and right margins to zero. Now click and select the first column (A). Right-click on it and click “Insert”. Then select B1 cell and copy formatting to A1 (which became blank). Similarly you got to do similar thing on the right side, a kind of agricultural way.

Again, kindly provide your desired Excel file (you may modify your input file in MS Excel) manually and save the file) where the print preview of the sheet should show your desired display.

By the way, you may also try to use Aspose.PDF API if it helps to accomplish the task. Once the output PDF is generated by Aspose.Cells APIs you may try to use Aspose.PDF to apply your desired formatting further (if possible) on the file. You may post your query with details in Aspose.PDF forum, one of my fellow colleagues from Aspose.PDF team will check and help you there.