Dear concern,
I am a software programmer and my company has aspose license.
I am having an issue with exporting HTML from an excel.
Excel has charts in it and I am exporting them as Base64 images in HTML. But the first image overlaps with second image in HTML, as I see Aspose adds a margin-left:6px. please see below the HTML in yellow.
I would appreciate it if you could help me with this.
Below is the HTMl Produced by Aspose and code snippet:
<td height='20' width='64' style='height:15pt;width:48pt;' align='left' valign='top'><span style='mso-ignore:vglayout;position:absolute;z-index:6;margin-left:6px;margin-top:6px;width:332px;height:360px'><img width='332' height='360' src="data:image/png;base64," name='Chart 7'></span><span style='mso-ignore:vglayout2'><table cellpadding='0' cellspacing='0'><tr><td height='20' width='64' style='height:15pt;width:48pt;border:none;'></td></tr></table></span></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td height='20' width='64' style='height:15pt;width:48pt;' align='left' valign='top'><span style='mso-ignore:vglayout;position:absolute;z-index:7;margin-left:-8px;margin-top:6px;width:332px;height:360px'><img width='332' height='360' src="data:image/png;base64," name='Chart 8'></span><span style='mso-ignore:vglayout2'><table cellpadding='0' cellspacing='0'><tr><td height='20' width='64' style='height:15pt;width:48pt;border:none;'></td></tr></table></span></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td height='20' width='64' style='height:15pt;width:48pt;' align='left' valign='top'><span style='mso-ignore:vglayout;position:absolute;z-index:8;margin-left:10px;margin-top:6px;width:332px;height:360px'><img width='332' height='360' src="data:image/png;base64," name='Chart 9'></span><span style='mso-ignore:vglayout2'><table cellpadding='0' cellspacing='0'><tr><td height='20' width='64' style='height:15pt;width:48pt;border:none;'></td></tr></table></span></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
My Code snippet is as below
ws = wb.Worksheets[sheetName];
ws.PageSetup.PrintArea = A1:G100;
ws.AutoFitColumns();
ws.AutoFitRows();
//// Set all margins as 0
ws.PageSetup.LeftMargin = 0;
ws.PageSetup.RightMargin = 0;
ws.PageSetup.TopMargin = 0;
ws.PageSetup.BottomMargin = 0;
ws.PageSetup.PrintGridlines = true;
ws.PageSetup.CenterHorizontally = true;
ws.PageSetup.CenterVertically = true;
var htmlSaveOptions = new HtmlSaveOptions
{
ExportHiddenWorksheet = false,
ExportActiveWorksheetOnly = true,
ExportGridLines = true,
ExportPrintAreaOnly = true,
ExportImagesAsBase64 = true,
ExportBogusRowData= false
};
ws.Workbook.Save("C:\\temp\\test.htm", htmlSaveOptions);