I’d posted this in the PDF forum and they sent me to the Cells forum. Here’s a link to that thread:
https://forum.aspose.com/t/130649
Essentially the problem is that when using an Excel template (with Smart Markers) to perform a merge, and then converting to PDF, the bottom of the PDF does not contain all of the information that was in the Excel template. Adeel indicates in the thread above that the information is missing from the XML, and therefore something must be up with Cells. Would you kindly take a look at these? I’ve attached the template and the output.
Thanks!
Mike
Hi again, Adeel.
I’ve put together a more complete test and I’m able to reproduce the problem
every time. Would you mind taking a look at this?
protected void Button1_Click(object sender, EventArgs e)
{
// Create a dataset
DataSet ds = new DataSet();
// Create a datatable
DataTable dt = new DataTable("Master");
dt.Columns.Add(new DataColumn("LEAD_FULLNAME", Type.GetType("System.String")));
dt.Columns.Add(new DataColumn("ACCOUNT_NAME", Type.GetType("System.String")));
dt.Columns.Add(new DataColumn("CONTACT_SUPPORT_END_DATE", Type.GetType("System.String")));
DataRow dr = dt.NewRow();
dr["LEAD_FULLNAME"] = "David Copperfield";
dr["ACCOUNT_NAME"] = "ABC Bank";
dr["CONTACT_SUPPORT_END_DATE"] = "10 - 03 - 2007";
dt.Rows.Add(dr);
ds.Tables.Add(dt);
// Create another data table
DataTable reportdata4 = new DataTable("ReportData4");
reportdata4.Columns.Add(new DataColumn("Asset_Name", Type.GetType("System.String")));
reportdata4.Columns.Add(new DataColumn("Latest_Release_Version", Type.GetType("System.String")));
dr = reportdata4.NewRow();
dr["Asset_Name"] = "ABC";
dr["Latest_Release_Version"] = "1.2";
reportdata4.Rows.Add(dr);
dr = reportdata4.NewRow();
dr["Asset_Name"] = "DEF";
dr["Latest_Release_Version"] = "1.4";
reportdata4.Rows.Add(dr);
ds.Tables.Add(reportdata4);
// Merge the table into the Excel template
WorkbookDesigner designer = new WorkbookDesigner();
// Open a designer spreadsheet containing smart markers
designer.Open(@"c:\Drew\ExcelTemplate2.xls");
// Set the data source for the designer spreadsheet
designer.SetDataSource(ds);
// Process the smart markers
designer.Process(false);
// Convert to PDF
// Save the word document to a memory stream
MemoryStream stream = new MemoryStream();
designer.Workbook.CalculateFormula(true);
designer.Workbook.Save(stream, FileFormatType.AsposePdf);
stream.Seek(0, SeekOrigin.Begin); // Reset the pointer to the beginning of the stream
// Load the document as raw XML
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(stream);
// Open in Aspose PDF
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(xmlDoc, null);
// Output the PDF to the browser
pdf.Save(@"output.pdf", Aspose.Pdf.SaveType.OpenInAcrobat, Response);
}
I’ve attached the template.