在我前面很多关于Visio的开发过程中,介绍了各种Visio的C#开发应用场景,包括对Visio的文档、模具文档、形状、属性数据、各种事件等相关的基础处理,以及Visio本身的整体项目应用,虽然时间过去很久,不过这些技术依旧还在使用中,最近应客户培训的需要,我对所有的内容进行了重 ...
在我前面很多关于Visio的开发过程中,介绍了各种Visio的C#开发应用场景,包括对Visio的文档、模具文档、形状、属性数据、各种事件等相关的基础处理,以及Visio本身的整体项目应用,虽然时间过去很久,不过这些技术依旧还在使用中,最近应客户培训的需要,我对所有的内容进行了重新整理,把一些没有介绍的很详细或者很少的内容进行了丰富,因此本文介绍的主题-Visio二次开发之文件导出及另存Web页面,介绍一下Visio文件另存为其他几种格式的处理,以及另存为Web文件等相关操作。
1、Visio导出为PDF格式
在一般情况下,PDF格式是较为常用的内容格式,因此Visio文档(Vsd格式)导出为PDF也是很常见的一件事情,Office文档本身很好支持PDF格式的输出,因此对于Visio来说,也不是什么难事,基本上利用它现有的API就可以导出为PDF格式了。
在Visio的Document文档对象中,就有ExportAsFixedFormat这个方法,可以导出为PDF或者XPS的格式的,这个格式有很多参数,用来确定导出那页,以及格式等设置。
expression.ExportAsFixedFormat(FixedFormat, OutputFileName, Intent, PrintRange, FromPage, ToPage, ColorAsBlack, IncludeBackground, IncludeDocumentProperties, IncludeStructureTags, UseISO19005_1, FixedFormatExtClass)
同时,这些参数的相关说明如下所示。
Name | Required/Optional | Data Type | Description |
---|
FixedFormat | Required | VisFixedFormatTypes | The format type in which to export the document. See Remarks for possible values. |
OutputFileName | Optional | String | The name and path of the file to which to output, enclosed in quotation marks. |
Intent | Required | VisDocExIntent | The output quality. See Remarks for possible values. |
PrintRange | Required | VisPrintOutRange | The range of document pages to be exported. See Remarks for possible values. |
FromPage | Optional | Long | If PrintRange is visPrintFromTo , the first page in the range to be exported. The default is 1, which indicates the first page of the draget='_blank'>wing. |
ToPage | Optional | Long | If PrintRange is visPrintFromTo , the last page in the range to be exported. The default is -1, which indicates the last page of the drawing. |
ColorAsBlack | Optional | Boolean | True to render all colors as black to ensure that all shapes are visible in the exported drawing. False to render colors normally. The default is False. |
IncludeBackground | Optional | Boolean | Whether to include background pages in the exported file. The default is True. |
IncludeDocumentProperties | Optional | Boolean | Whether to include document properties in the exported file. The default is True. |
IncludeStructureTags | Optional | Boolean | Whether to include document structure tags to improve document accessibility. The default is True. |
UseISO19005_1 | Optional | Boolean | Whether the resulting document is compliant with ISO 19005-1 (PDF/A). The default is False. |
FixedFormatExtClass | Optional | [UNKNOWN] | A pointer to a class that implements the IMsoDocExporter interface for purposes of creating custom fixed output. The default is a null pointer. |
原标题:C#进行Visio二次开发之文件导出及另存Web页面
关键词:C#
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。