Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue Sep 17, 2019 9:53 am

Hello!

I am trying to test following the following example of VS2015 for Spire.XLS.
In particular the MarkerDesigner-VS2015 project: The idea is test marker with tables and convert the xlsx result to pdf.

I have taken the opportunity to convert the xls into a pdf after apply the MarkerDesigner.
The problem is that in your example, page breaks automatically adapt and generate the pdf well, but in my example it does not.
What should I do to adjust the page breaks so that the pdf comes out correctly?

I have used the same code to generate both files. I attach the result.

Thank you very much for your help!



Workbook workbook = new Workbook();
Workbook workbookTest = new Workbook();

workbook.LoadFromFile(@"D:\temp\AMPO\Puebas Spire XLS\Demos\Data\MarkerDesigner.xls");
workbookTest.LoadFromFile(@"D:\temp\AMPO\Puebas Spire XLS\Demos\Data\SubVendorList.xlsx");
DataTable dt = (DataTable)dataGrid1.DataSource;

Worksheet sheet = workbook.Worksheets[0];
Worksheet sheetTest = workbookTest.Worksheets[0];

//Fill parameter
//workbook.MarkerDesigner.AddParameter("Variable1","1234.5678");

//Fill DataTable
workbook.MarkerDesigner.AddDataTable("Country",dt);
workbookTest.MarkerDesigner.AddDataTable("Country", dt);

try
{
workbook.MarkerDesigner.Apply();
workbook.SaveToFile(@"d:\test.xlsx", ExcelVersion.Version2010);
workbook.SaveToFile(@"d:\test.pdf", FileFormat.PDF);


workbookTest.MarkerDesigner.Apply();
workbookTest.SaveToFile(@"d:\test2.xlsx", ExcelVersion.Version2010);
workbookTest.SaveToFile(@"d:\test2.pdf", FileFormat.PDF);
}
catch (Exception)
{

}
Attachments
Results.rar
(203.25 KiB) Downloaded 176 times

LauraNM
 
Posts: 77
Joined: Tue Feb 19, 2019 1:23 pm

Wed Sep 18, 2019 1:59 am

Hi,

Thanks for your inquiry.
After further investigation, I found your Excel sheet has set print area "A1:I11", so the PDF result only prints the area "A1:I11". Please use following code to remove the print area setting.
Code: Select all
sheetTest.PageSetup.PrintArea = "";

If there is still issue, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Sep 18, 2019 8:51 am

Perfect! Thank you very much!!

LauraNM
 
Posts: 77
Joined: Tue Feb 19, 2019 1:23 pm

Wed Sep 18, 2019 9:09 am

Hi,

Thanks for your feedback.
If there is any question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.XLS