如何解决RichView导出Html看不到中文问题

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;

你可能感兴趣的:(html,properties,XHTML,image,styles)