Excel 2003 VSTO convert to PDF
Posted
by KClough
on Stack Overflow
See other posts from Stack Overflow
or by KClough
Published on 2010-03-17T15:02:29Z
Indexed on
2010/04/11
16:33 UTC
Read the original article
Hit count: 318
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.
© Stack Overflow or respective owner