![](/img/trans.png)
[英]Extract bullets from word document using aspose.words in C#
[英]Extract Bullets and Tables information in Word doc from c#
我需要基於c#中的模板創建word文檔。 我只有段落的標簽。 有什么方法可以根據用戶輸入替換模板中已經可用的項目符號和表格。
我可以使用Word InterOp中的“替換”命令將段落替換為輸入文本。
需要幫助來完成其余的項目。
用於根據標簽替換段落的代碼:
FindAndReplace(wordApplication, "/date/", DateTime.Now.Date.ToString("MMM dd, yyyy"));
FindAndReplace(){
wordApplication.Selection.Find.Execute(ref findText,
ref matchCase, ref matchWholeWord, ref matchWildCards, ref matchSoundsLike,
ref matchAllWordsForms, ref forward, ref wrap, ref format, ref replaceWithText, ref replace, ref matchKashida,
ref matchDiacritics, ref matchAlefHamsa, ref matchControl);
}
提前致謝。 盡快
我建議將書簽放入Word文檔中,並使用它們來分配數據。
object oBookMark = "MyBookmark";
oWordDoc.Bookmarks.Item(ref oBookMark).Range.Text = "Some Text Here";
您可以使用此方法填充表格,我想您應該能夠填充項目符號點。
這是以編程方式填充Word模板的普遍接受的方法。 匹配字符串難以編寫和准確維護,並且很容易產生意外結果。 使用書簽,您可以知道要分配的數據以及數據的去向。
看一下這個Coderush項目 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.