←选择平台

RtfDocumentOptions类

总结
提供在使用富文本格式(RTF)保存文档时使用的额外选项。
语法
c#
VB
objective - c
c++
Java
[SerializableAttribute ()][DataContractAttribute ()]公共RtfDocumentOptions:DocumentOptions
< DataContractAttribute () >< SerializableAttribute () >公共RtfDocumentOptions继承了DocumentOptions
@接口LTRtfDocumentOptions: LTDocumentOptions 
公共RtfDocumentOptions扩展DocumentOptions
[DataContractAttribute ()][SerializableAttribute ()]公共ref类RtfDocumentOptions:公共DocumentOptions
讲话

中设置的选项RtfDocumentOptions类保存文档时,将使用DocumentFormat.Rtf格式。

要更改RTF格式使用的选项,请执行以下步骤:

  1. 使用DocumentWriter。GetOptions的方法DocumentWriter正在使用的对象。通过DocumentFormat.Rtf格式参数。注意,从基类得到的结果对象DocumentOptions类需要转换为RtfDocumentOptions
  2. 使用各种RtfDocumentOptions属性来更改选项。
  3. 使用DocumentWriter。setoption在引擎中设置新选项。
  4. 现在您可以调用DocumentWriter。BeginDocument方法(DocumentFormat.Rtf格式参数)来创建一个新文档并添加页面。

RtfDocumentOptions类包含以下属性:

财产 描述
文本模式 控制如何以及何时为结果RTF文件中的文本块设置帧。

注意,这种格式不支持调用DocumentWriter。InsertPage

例子

本示例将使用各种受支持的选项创建一个新的超文本标记语言文档(RTF)文件。

c#
VB
使用Leadtools.Document.Writer;使用Leadtools;使用Leadtools.Codecs;公共无效RtfDocumentOptionsExample ()varinputFileName = Path.Combine(LEAD_VARS.ImagesDir,“Leadtools.pdf”);varoutputFileName = Path.Combine(LEAD_VARS.ImagesDir,“Example.rtf”);//设置一个新的RasterCodecs对象var编解码器=RasterCodecs ();codecs.Options.RasterizeDocument.Load.Resolution = 300;//获取输入文档的页数varpageCount = codecs.GetTotalPages(inputFileName);//创建一个新的LEADTOOLS Document Writer实例vardocWriter =DocumentWriter ();//修改RTF选项varrtfOptions = docWriter.GetOptions(DocumentFormat.Rtf)作为RtfDocumentOptions;rtfOptions。文本模式=文档文本模式.汽车;docWriter.SetOptions (DocumentFormat.Rtf rtfOptions);//创建一个新的Rtf文档控制台。WriteLine ("正在创建新的Rtf文档:{0}", outputFileName);docWriter。BeginDocument (outputFileName DocumentFormat.Rtf);//循环遍历所有页面varpageNumber = 1;pageNumber <= pageCount;pageNumber + +)//获取页面为SVG控制台。WriteLine (“正在加载页面{0}”, pageNumber);var页面=DocumentWriterSvgPage ();页面。SvgDocument = codecs。LoadSvg (inputFileName pageNumber,);//添加页面控制台。WriteLine ("添加页面{0}", pageNumber);docWriter.AddPage(页面);page.SvgDocument.Dispose ();//最终完成在磁盘上写入Rtf文件docWriter.EndDocument ();codecs.Dispose ();静态LEAD_VARS公共常量字符串ImagesDir =@“C: \ LEADTOOLS21 \ Resources \图片”
进口Leadtools.Document.Writer进口Leadtools进口Leadtools。编解码器公共RtfDocumentOptionsExample ()昏暗的inputFileName作为字符串= Path.Combine (LEAD_VARS.ImagesDir“Leadtools.pdf”昏暗的outputFileName作为字符串= Path.Combine (LEAD_VARS.ImagesDir“Example.rtf”’设置一个新的RasterCodecs对象昏暗的编解码器作为RasterCodecs ()codecs.Options.RasterizeDocument.Load.Resolution = 300'获取输入文档的页数昏暗的pageCount作为整数= codecs.GetTotalPages (inputFileName)创建一个新的LEADTOOLS Document Writer实例昏暗的docWriter作为DocumentWriter ()更改RTF选项昏暗的rtfOptions作为RtfDocumentOptions =DirectCast(docWriter.GetOptions (DocumentFormat.Rtf)、RtfDocumentOptions)rtfOptions。文本模式=文档文本模式.汽车docWriter.SetOptions (DocumentFormat.Rtf rtfOptions)创建一个新的Rtf文档控制台。WriteLine ("正在创建新的Rtf文档:{0}"outputFileName)docWriter。BeginDocument (outputFileName DocumentFormat.Rtf)循环浏览所有页面pageNumber作为整数= 1pageCount’获取SVG页面控制台。WriteLine (“正在加载页面{0}”pageNumber)昏暗的页面作为DocumentWriterSvgPage ()页面。SvgDocument = codecs。LoadSvg (inputFileName pageNumber,没有什么添加页面控制台。WriteLine ("添加页面{0}"pageNumber)docWriter.AddPage(页面)page.SvgDocument.Dispose ()下一个'最后完成在磁盘上写入Rtf文件docWriter.EndDocument ()codecs.Dispose ()结束公共NotInheritableLEAD_VARS公共常量ImagesDir作为字符串“C: \ LEADTOOLS21 \ Resources \图片”结束
需求

目标平台

Leadtools.Document.Writer组装
188金宝搏的网址客服|支持|联系我们|知识产权公告
©1991 - 2021领先技术公司版权所有