如何解决RichView导出Html看不到中文问题
1、 问题描述:调用RichViewEdit.SaveHTMLToStream的方法可以生成html文件,但是默认导出的不是中文码,而是ASCII码。如何解决这个问题呢?2、解决办法:这个方法的最后一个参数可以用来解决这个问题SaveHTMLToStream(Stream: TStream; const Path, Title, ImagesPrefix: String; Op
1、 问题描述:
调用RichViewEdit.SaveHTMLToStream的方法可以生成html文件,但是默认导出的不是中文码,而是ASCII码。如何解决这个问题呢?
2、解决办法:
这个方法的最后一个参数可以用来解决这个问题
SaveHTMLToStream(Stream: TStream; const Path, Title, ImagesPrefix: String; Options: TRVSaveOptions):Boolean;
将Options参数设置为[rvsoUTF8]即可,参数说明如下:
{ Options for saving HTML files, TCustomRichView.SaveHTML and SaveHTMLEx methods }
TRVSaveOption = (
rvsoOverrideImages, // Overwrite image files (if not set - use unique)
rvsoFirstOnly, // Save only heading part of HTML
rvsoMiddleOnly, // Save only middle part of HTML (document itself)
rvsoLastOnly, // Save only ending part of HTML
rvsoDefault0Style, // Do not save properties for the 0-th text style
rvsoNoHypertextImageBorders, // Supress borders for hypertext images
rvsoImageSizes, // Write image size
rvsoForceNonTextCSS,// Always use CSS for non-text items
rvsoUseCheckpointsNames, // Use "checkpoint names" instead of indices
rvsoMarkersAsText, // Save paragraph bullets/numbering without <UL>/<OL>
rvsoInlineCSS, // Write CSS directly in <P> and <SPAN> tags
// (only for SaveHTMLEx)
rvsoNoDefCSSStyle, // Use named CSS for all text styles, even for
// TextStyles[0] (by default, properties of
// TextStyles[0] are assigned to BODY and TABLE).
// This option generates larger HTML (not recommended).
// (only for SaveHTMLEx)
rvsoUseItemImageFileNames, // If set, images having specified
// (in extra string properties) file names will not
// be saved, but their file names will be written
// in HTML (relative to the HTML file path)
rvsoXHTML, // Save XHTML
rvsoUTF8); // Use UTF8 encoding
TRVSaveOptions = set of TRVSaveOption;

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。
更多推荐
所有评论(0)