我有一個HTML
文檔這就需要在MS Word被打開查找文本。它每頁2-3頁後都有特定字體/顏色的標題文本(可以說13.5pt &顏色代碼是#ff11ff)&我希望找到其中包含標題文本的頁碼。C#/ MS Word中 - 使用的字體大小或顏色
HTML
什麼HTML
標籤可以方便地檢測到MS Word環境中的特定文本的存在?據我所知,我們可以使用查找方法檢測文本,但我不知道是否有任何方法來搜索特定的'字體/字體顏色',
我需要這個創建索引頁將具有標題&的頁碼的名稱,在其上找到它們。因此,它是這樣:
- 查找特定的字體大小的文本。
- 獲取該頁面的當前頁碼。
更新: 好像我必須反覆文檔的每個文本&檢查它的字體&然後像做
Microsoft.Office.Interop.Word._Application word = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word._Document document;
while (word.Selection.Find.Execute(ref findStr, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull))
{
float fontSize = word.Selection.Font.Size;
if (fontSize == 13.5)
{
Range rng = word.Selection.Range;
int pageNp = (int)rng.get_Information(WdInformation.wdActiveEndPageNumber);
}
}
你爲什麼要問什麼range.Find.Execute確實..?你可以做一個'谷歌Search'爲http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.find.execute%28v=office.11%29.aspx 也不要指望我們爲你編碼這個..你有什麼自己嘗試過..? – MethodMan
生活在SO上發生了變化。概念性問題可能會被關閉。 SAD :( –
@ DJKRAZE-更新的問題。 –