Excel 2003 VSTO convert to PDF
- by KClough
I have an excel workbook vsto solution that needs to generate a pdf copy of one of its sheets as output.
I have a license for abcdpdf .net and tried outputting to html, then using abcpdf to convert the html to pdf, but the excel html markup tries to emulate excel with all 4 worksheets with horrible markup. It also messes up the colors (silver background across entire workbook).
Any suggestions?
Here is the code I'm currently using to generate the html file:
FileInfo excelDoc = new FileInfo(Globals.ThisWorkbook.Path + @"\Document.html");
Globals.Sheet2.SaveAs(excelDoc.FullName,
Excel.XlFileFormat.xlHtml, missing, missing, false, false,
Excel.XlSaveAsAccessMode.xlNoChange,
missing, missing, missing);
If I hack away some of the html header tags manually, I can get abcdpf to accept it, but the formatting is a bit off and this solution seems sub optimal.
Thanks in advance.