private void Button2_Click(object sender, EventArgs e) { string xlsFileName; if (string.IsNullOrWhiteSpace(_pdfFileName)) { MessageBox.Show("Please, choose a file!", "Missing file!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var excelSaveOption = new ExcelSaveOptions { ScaleFactor = trackBar1.Value / 100.0, InsertBlankColumnAtFirst = checkBox1.Checked, MinimizeTheNumberOfWorksheets = checkBox2.Checked, }; if (radioButton1.Checked) { xlsFileName = System.IO.Path.ChangeExtension(_pdfFileName, "xml"); excelSaveOption.Format = ExcelSaveOptions.ExcelFormat.XMLSpreadSheet2003; } else { xlsFileName = System.IO.Path.ChangeExtension(_pdfFileName, "xlsx"); excelSaveOption.Format = ExcelSaveOptions.ExcelFormat.XLSX; } Module1.SaveToExcel(asposeFilePdf: _pdfFileName, asposeFileXls: xlsFileName, excelSaveOption: excelSaveOption); label2.Text = $"File converted to {xlsFileName}"; }
public static void Run() { // ExStart:PDFToXLS // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion(); // Load PDF document Document pdfDocument = new Document(dataDir + "input.pdf"); // Instantiate ExcelSave Option object Aspose.Pdf.ExcelSaveOptions excelsave = new ExcelSaveOptions(); // Save the output in XLS format pdfDocument.Save("PDFToXLS_out.xls", excelsave); // ExEnd:PDFToXLS }
public static void ControlColumn() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion(); // Load PDF document Document pdfDocument = new Document(dataDir + "input.pdf"); // ExStart:ControlColumn // Instantiate ExcelSave Option object Aspose.Pdf.ExcelSaveOptions excelsave = new ExcelSaveOptions(); excelsave.InsertBlankColumnAtFirst = false; // ExEnd:ControlColumn // Save the output in XLS format pdfDocument.Save("PDFToXLSControlColumn_out.xls", excelsave); }
public static void ExportAllPagesToSingle() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion(); // Load PDF document Document pdfDocument = new Document(dataDir + "input.pdf"); // ExStart:ExportAllPagesToSingle // Instantiate ExcelSave Option object Aspose.Pdf.ExcelSaveOptions excelsave = new ExcelSaveOptions(); // Set this property to true excelsave.MinimizeTheNumberOfWorksheets = true; // ExEnd:ExportAllPagesToSingle // Save the output in XLS format pdfDocument.Save("PDFToXLSExportAllPagesToSingle_out.xls", excelsave); }
public static void SaveToExcel(string asposeFilePdf, string asposeFileXls, ExcelSaveOptions excelSaveOption) { var pdfDocument = new Document(filename: asposeFilePdf); pdfDocument.Save(asposeFileXls, excelSaveOption); }