Class ExcelSaveOptions

ExcelSaveOptions class

导出到 Excel 格式的保存选项

public class ExcelSaveOptions : UnifiedSaveOptions

构造函数

名称描述
ExcelSaveOptions()默认构造函数。

属性

名称描述
CacheGlyphs { get; set; }获取或设置一个布尔值,指示在准备 aps 页面时是否将字体字形缓存。提高将 PDF 转换为其他格式的性能,但会增加内存消耗。
CloseResponse { get; set; }获取或设置一个布尔值,指示在文档保存到响应后是否关闭 Response 对象。
ExtractOcrSublayerOnly { get; set; }此属性启用从具有 OCR 子层的 PDF 文档中提取图像或文本的功能。
Format { get; set; }输出格式
InsertBlankColumnAtFirst { get; set; }如果需要将空列插入为工作表的第一列,则设置为 true。默认值为 false;这意味着不会插入空列。
MinimizeTheNumberOfWorksheets { get; set; }如果需要最小化结果工作簿中的工作表数量,则设置为 true。默认值为 false;这意味着将每个 PDF 页面保存为单独的工作表。
SaveFormat { get; }数据保存的格式。
UniformWorksheets { get; set; }设置为 true 以在整个文档中使用统一的列划分。默认值为 false;这意味着每页的列划分将是独立的。
WarningHandler { get; set; }处理生成的任何警告的回调。WarningHandler 返回 ReturnAction 枚举项,指定继续或中止。继续是默认操作,保存操作继续进行,但用户也可以返回中止,在这种情况下,保存操作应停止。

字段

名称描述
IsMultiThreading在多个线程中处理页面。
TryMergeAdjacentSameBackgroundImages有时 PDF 包含由几个相同的平铺背景图像构成的背景图像(页面或表格单元格)。在这种情况下,目标格式的渲染器(例如 DOCS 格式的 MsWord)有时会在背景图像的部分之间生成可见的边界,因为它们的图像边缘平滑(抗锯齿)技术与 Acrobat Reader 不同。如果导出的文档看起来包含这样的可见边界,请尝试使用此设置来消除这种不必要的效果。注意!这种质量优化通常会显著减慢转换速度,因此,请仅在确实必要时使用此选项。

示例

以下示例演示如何将 PDF 文件转换为 XLS 或 XLSX 文件

[C#]
	// The path to the documents directory.
	string dataDir = "YOUR_DATA_DIRECTORY";

	// The path to your PDF File.
	var pdfFile = Path.Combine(dataDir, "PDF-to-xlsx.pdf");

	// The path to output xls or xlsx File.
	var excelFile= Path.Combine(dataDir, "PDF-to-xlsx.xlsx");
		
	using (Document pdfDocument = new Document(pdfFile))
	{
		// Initialize ExcelSaveOptions	
		ExcelSaveOptions saveOptions = new ExcelSaveOptions();
		
		// Save xls or xlsx file
		pdfDocument.Save(excelFile, saveOptions);
	}
[VB.NET]

    ' The path to the documents directory.
    Dim dataDir As String = "YOUR_DATA_DIRECTORY"
    
	' The path to your PDF File.
    Dim pdfFile = Path.Combine(dataDir, "PDF-to-xlsx.pdf")
    
	' The path to output xls or xlsx File.
    Dim excelFile = Path.Combine(dataDir, "PDF-to-xlsx.xlsx")
 
    Using pdfDocument As Document = New Document(pdfFile)
        ' Initialize ExcelSaveOptions  
        Dim saveOptions As ExcelSaveOptions = New ExcelSaveOptions()
 
        ' Save xls or xlsx file
        pdfDocument.Save(excelFile, saveOptions)
    End Using

另请参见