gpt4 book ai didi

excel - 通过 API 将文件另存为 PDF 所需的 Excel 2007 中 PDF 的文件类型号是多少?

转载 作者:行者123 更新时间:2023-12-03 01:24:28 25 4
gpt4 key购买 nike

我需要调用一个函数来保存 Excel 工作簿。我安装了 Excel 2007 的 PDF 保存插件,但现在我需要知道保存 Excel 文件时文件格式的数字代码是什么。

可在此处找到 Excel 文件格式数字的示例。

http://www.dailydoseofexcel.com/archives/2006/10/29/saveas-in-excel-2007/

FileExtStr = ".xlsb": FileFormatNum = 50
FileExtStr = ".xlsx": FileFormatNum = 51
FileExtStr = ".xlsm": FileFormatNum = 52
FileExtStr = ".xls": FileFormatNum = 56
FileExtStr = ".csv": FileFormatNum = 6
FileExtStr = ".txt": FileFormatNum = -4158
FileExtStr = ".prn": FileFormatNum = 36

我需要 .pdf 结尾的一个。

最佳答案

查看 Workbook.ExportAsFixedFormat方法:

ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF 
FileName:=“sales.pdf”
Quality:=xlQualityStandard
DisplayFileAfterPublish:=True

此方法应该优于使用 SaveAs,因为它还允许指定所有 PDF/XPS 选项。

注意:此方法已添加到 Excel 2007 的 Excel 对象模型中,并且需要 Save as PDF or XPS Add-in用于安装 2007 Microsoft Office 程序。

关于excel - 通过 API 将文件另存为 PDF 所需的 Excel 2007 中 PDF 的文件类型号是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/738829/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com