ExportDocumentRTF

文字擷取與轉換

描述

把整份文件(或某個頁面範圍)擷取為自給自足的 RTF 文件,建立在與 DOCX、Markdown 寫出器相同的結構化文字模型上:偵測到的標題轉為按比例縮放字級的粗體標題,段落經共用字型表與顏色表保留 span 層級字型、字級與顏色,偵測到的表格轉為帶框線的表格列

頁面之間以分頁符號分隔;options 接受 PDF_RTF_DETECT_HEADINGS(1)與 PDF_RTF_PRESERVE_STYLES(2),傳 0 表示兩者都啟用

語法

Delphi

Function TPDFlib.ExportDocumentRTF(Const PageRange: WideString; Options: Integer): WideString;

ActiveX

Function PDFlib::ExportDocumentRTF(PageRange As String, Options As Long) As String

DLL

const wchar_t* DLExportDocumentRTF(int InstanceID, const wchar_t* PageRange, int Options);
const char* DLExportDocumentRTFA(int InstanceID, const char* PageRange, int Options);

參數

PageRange1 起算的範圍,例如 1-3,7;空字串表示所有頁面
OptionsPDF_RTF_DETECT_HEADINGS(1)、PDF_RTF_PRESERVE_STYLES(2)與 PDF_RTF_INCLUDE_IMAGES(4)的組合,或 PDF_RTF_DEFAULT(7);其他位元會設定 PDFLIB_ERROR_MARKDOWN_EXPORT_INVALID

傳回值

RTF完整的 RTF 文件,WideString 形式
Empty驗證、取消或擷取失敗;原因見 LastErrorCode

另請參閱

ExportPageRTF, ExportDocumentMarkdown, SaveDOCXToStream