主题:word文档最后一段字符存变量中的问题
//以下代码是要从现金备忘录文档中提取所需要的数据Cash Memo No.和Total amount payable字段的信息。
//创建类型Range的对象wdRange, 其中存储了Word文档的内容。
Word.Range wdRange;
//Cash Memo No.在文档的第二段, Paragraphs[2]表示第二段
wdRange=Doc.Paragraphs[2].Range;//存储第二段的内容
string strMemo,strAmount;
int intParacount;
strMemo=wdRange.Text;
strMemo=strMemo.Substring(15,4);
intParacount=Doc.Paragraphs.Count;
//以下代码看不懂,请高手解释,不胜感激!!!!!!!!!!!
intParacount=intParacount-2;
wdRange=Doc.Paragraphs[intParacount].Range;
object count="-1";
object wdCharacter="1";
wdRange.MoveEnd(ref wdCharacter,ref count);
strAmount=wdRange.Text;
strAmount=strAmount.Substring(23);
//创建类型Range的对象wdRange, 其中存储了Word文档的内容。
Word.Range wdRange;
//Cash Memo No.在文档的第二段, Paragraphs[2]表示第二段
wdRange=Doc.Paragraphs[2].Range;//存储第二段的内容
string strMemo,strAmount;
int intParacount;
strMemo=wdRange.Text;
strMemo=strMemo.Substring(15,4);
intParacount=Doc.Paragraphs.Count;
//以下代码看不懂,请高手解释,不胜感激!!!!!!!!!!!
intParacount=intParacount-2;
wdRange=Doc.Paragraphs[intParacount].Range;
object count="-1";
object wdCharacter="1";
wdRange.MoveEnd(ref wdCharacter,ref count);
strAmount=wdRange.Text;
strAmount=strAmount.Substring(23);