翻譯|使用教程|編輯:李顯亮|2021-09-15 10:35:57.503|閱讀 383 次
概述:Markdown 是用于創(chuàng)建格式化文本文件的標(biāo)記文本。本文介紹了如何將 Markdown .md 文件轉(zhuǎn)換為 Word 文檔作為DOCX / DOC格式文件,以及從 Markdown 轉(zhuǎn)換為XPS文件。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Markdown 是用于創(chuàng)建格式化文本文件的標(biāo)記文本。本文介紹了如何將 Markdown .md 文件轉(zhuǎn)換為 Word 文檔作為DOCX / DOC格式文件,以及從 Markdown 轉(zhuǎn)換為XPS文件:
Aspose.HTML for .NET API支持使用 HTML、Markdown、XPS 和其他不同的文件格式。,點(diǎn)擊下方按鈕下方使用。
可以使用以下步驟將具有 .md 文件擴(kuò)展名的 Markdown 文件轉(zhuǎn)換為 DOCX 或 DOC 格式的 Word 文件:
以下代碼展示了如何使用 C# 將 Markdown MD 文件轉(zhuǎn)換為 DOCX 或 DOC 中的 Word 文檔:
// Prepare a path to a source Markdown file string sourcePath = dataDir + "nature.md"; // Prepare a path for converted DOCX file saving string savePath = dataDir + "nature-output.docx"; // Convert Markdown to HTML document HTMLDocument document = Converter.ConvertMarkdown(sourcePath); // Initialize DocSaveOptions. Set up the page-size and margins DocSaveOptions options = new DocSaveOptions(); options.PageSetup.AnyPage = new Page(new Size(500, 1000), new Margin(20, 20, 10, 10)); // Convert HTML document, created from Markdown file to DOCX file format Converter.ConvertHTML(document, options, savePath);
可以通過以下步驟將 Markdown 文件轉(zhuǎn)換為 XPS 文件:
下面的代碼解釋了如何使用 C# 將 Markdown .md 文件轉(zhuǎn)換為 XPS 文件:
// Prepare a path to a source Markdown file string sourcePath = dataDir + "nature.md"; // Prepare a path for converted PDF file saving string savePath = dataDir + "nature-output.xps"; // Convert Markdown to HTML var document = Converter.ConvertMarkdown(sourcePath); // Initialize XpsSaveOptions. Set up the resilutions, page-size, margins and change the background color to AntiqueWhite var options = new Aspose.Html.Saving.XpsSaveOptions() { HorizontalResolution = 200, VerticalResolution = 200, BackgroundColor = System.Drawing.Color.AntiqueWhite }; options.PageSetup.AnyPage = new Page(new Size(Length.FromInches(5.0f), Length.FromInches(10.0f)), new Margin(30, 20, 10, 10)); // Convert the Markdown MD file to XPS file format Converter.ConvertHTML(document, options, savePath);
如果你想試用Aspose的全部完整功能,可聯(lián)系在線客服獲取30天臨時授權(quán)體驗(yàn)。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn