GemBox.Spreadsheet is a .NET component that enables you to read, write, convert, and print spreadsheet files (XLSX, XLS, XLSB, CSV, HTML, and ODS) from .NET applications in a simple and efficient way.
Hi team, I have used the sample code for converting an excel file to PDF but the images are not moved to HTML
// Set license key to use GemBox.Spreadsheet in Free mode.
SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");varworkbook= ExcelFile.Load(@"D:\Work\DotNet\TestViewer\DocumentViewer\storage\test.xls");varworksheet= workbook.Worksheets[0];// Some of the properties from ExcelPrintOptions class are supported in HTML export.
worksheet.PrintOptions.PrintHeadings =true;
worksheet.PrintOptions.PrintGridlines =true;// Print area can be used to specify custom cell range which should be exported to HTML.
worksheet.NamedRanges.SetPrintArea(worksheet.Cells.GetSubrange("A1","M42"));varoptions=new HtmlSaveOptions(){HtmlType= HtmlType.Html,SelectionType= SelectionType.EntireFile,EmbedImages=true,};
workbook.Save(@"D:\Work\DotNet\TestViewer\DocumentViewer\storage\HtmlExport.html", options);
How to change the paper size of the printer when printing from an Excel file?
For example, set the paper size to store printers(8cm).
varworkbook=new ExcelFile();varworksheet= workbook.Worksheets.Add("Print and View Options");
worksheet.Cells["M1"].Value ="This worksheet shows how to set various print related and view related options.";
worksheet.Cells["M2"].Value ="To see results of print options, go to Print and Page Setup dialogs in MS Excel.";
worksheet.Cells["M3"].Value ="Notice that print and view options are worksheet based, not workbook based.";varprintOptions= worksheet.PrintOptions;
printOptions.PrintGridlines =true;
printOptions.PrintHeadings =true;
printOptions.Portrait =false;
printOptions.PaperType = PaperType.A3;
printOptions.NumberOfCopies =5;
worksheet.ViewOptions.FirstVisibleColumn =3;
worksheet.ViewOptions.ShowColumnsFromRightToLeft =true;
worksheet.ViewOptions.Zoom =123;
worksheet.NamedRanges.SetPrintArea(worksheet.Cells.GetSubrange("E1","U7"));
workbook.Save("Print and View Options.xlsx");