翻譯|使用教程|編輯:李顯亮|2019-06-19 15:02:02.147|閱讀 438 次
概述:Aspose.Words For .Net是一種高級(jí)Word文檔處理API,用于執(zhí)行各種文檔管理和操作任務(wù)。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
Aspose.Words For .Net是一種高級(jí)Word文檔處理API,用于執(zhí)行各種文檔管理和操作任務(wù)。API支持生成,修改,轉(zhuǎn)換,呈現(xiàn)和打印文檔,而無(wú)需在跨平臺(tái)應(yīng)用程序中直接使用Microsoft Word。此外,API支持所有流行的Word處理文件格式,并允許將Word文檔導(dǎo)出或轉(zhuǎn)換為固定布局文件格式和最常用的圖像/多媒體格式。
【下載Aspose.Words for .NET最新試用版】
在MS Word中顯示文檔取決于在該文檔的默認(rèn)值中設(shè)置的語(yǔ)言。但是,如果沒有語(yǔ)言設(shè)置為默認(rèn)值,該怎么辦?在這種情況下,Word從“ 設(shè)置Office語(yǔ)言首選項(xiàng) ”對(duì)話框中獲取信息,例如,可以在Word 2016中的“文件 - >選項(xiàng) - >語(yǔ)言”菜單下找到。使用Aspose.Words,您可以設(shè)置語(yǔ)言首選項(xiàng)使用LanguagePreferences類。
下面的代碼示例顯示了如何將日語(yǔ)添加到編輯語(yǔ)言中:
//文檔目錄的路徑。 LoadOptions loadOptions = new LoadOptions(); loadOptions.LanguagePreferences.AddEditingLanguage(EditingLanguage.Japanese); Document doc = new Document(dataDir + @"languagepreferences.docx", loadOptions); int localeIdFarEast = doc.Styles.DefaultFont.LocaleIdFarEast; if (localeIdFarEast == (int)EditingLanguage.Japanese) Console.WriteLine("The document either has no any FarEast language set in defaults or it was set to Japanese originally."); else Console.WriteLine("The document default FarEast language was set to another than Japanese language originally, so it is not overridden.");
下面的代碼示例顯示如何將俄語(yǔ)設(shè)置為默認(rèn)編輯語(yǔ)言:
//文檔目錄的路徑。 LoadOptions loadOptions = new LoadOptions(); loadOptions.LanguagePreferences.SetAsDefault(EditingLanguage.Russian); Document doc = new Document(dataDir + @"languagepreferences.docx", loadOptions); int localeId = doc.Styles.DefaultFont.LocaleId; if (localeId == (int)EditingLanguage.Russian) Console.WriteLine("The document either has no any language set in defaults or it was set to Russian originally."); else Console.WriteLine("The document default language was set to another than Russian language originally, so it is not overridden.");
如果要與其他人共享Word文檔,可以刪除個(gè)人信息,例如作者姓名和公司。您可以使用Document.RemovePersonalInformation屬性設(shè)置標(biāo)志,指示Microsoft Word將在保存文檔時(shí)從注釋,修訂和文檔屬性中刪除所有用戶信息。
注意:在Aspose.Words中處理文檔時(shí),設(shè)置此選項(xiàng)實(shí)際上不會(huì)刪除個(gè)人信息,并且僅影響Microsoft Word行為。
Document doc = new Document(dataDir + "Properties.doc"); doc.RemovePersonalInformation = true; dataDir = dataDir + "RemovePersonalInformation_out.docx"; doc.Save(dataDir);
ASPOSE技術(shù)交流QQ群(642018183)已開通,各類資源及時(shí)分享,歡迎交流討論!
慧都20萬(wàn)+用戶答謝惠,ASPOSE系列產(chǎn)品火熱促銷中,最高直降8萬(wàn)元!>>立即領(lǐng)取優(yōu)惠
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn