- Code: Select all
Document document = new Document();
document.LoadFromFile(@"E:\Work\Documents\WordDocuments\New Zealand.docx");
document .FindString("^l( )(1)", true, true);
以下為word內容範例 ?號後面有一個手動分行符號
流浪狗跟流浪貓,還有許多寵物被丟棄下列哪些是正確的做法?
( )(1)確實栓好,避免走失
( )(2)貓狗都需要活動
我想要找到 手動分行符號( )(1) 所屬段落
你好我想問一下 Shift+Enter Spire.Doc 在 是甚麼符號
我有試過以下代碼是找的到的
- Code: Select all
Regex regex = new Regex(@"\( \)\(1\)");
TextSelection[] textSelections1 = document.FindAllPattern(regex);
但改為以下代碼就找不到了
- Code: Select all
Regex regex = Regex(@"^l\( \)\(1\)");
TextSelection[] textSelections1 = document.FindAllPattern(regex);
此問題已解正確答案是
- Code: Select all
Regex regex = new Regex(@"\v\( \)\(1\)");
TextSelection[] textSelections1 = document.FindAllPattern(regex);