word自動校正ph怎么設(shè)置 allin中文是什么意思?
allin中文是什么意思?Allin[姓名][英國姓氏Allin Allc#讀取word指定表格內(nèi)容?1.注意Office版本。一般在office2016環(huán)境下寫的東西是無法在office2013環(huán)境
allin中文是什么意思?
Allin[姓名][英國姓氏Allin All
c#讀取word指定表格內(nèi)容?
1.注意Office版本。一般在office2016環(huán)境下寫的東西是無法在office2013環(huán)境下運行的。(據(jù)說可以通過第三方庫支持,以后慢慢研究)
2.注意中斷程序號一定要從電腦上注銷,否則docx文件總是提示被占用。
3.請注意,必須添加try catch finally。
4、通過正則表達式排除冗余符號。
///摘要///獲取word文件的文本內(nèi)容。
////摘要
/// param namedocFileName/param
///返回/返回
私有字符串DocToExcel2(字符串docFileName)
{
//實例化COM
app空;
wd null
對象nullobj
對象fileobj docFileName
字符串上下文字符串??盏模?/p>
嘗試
{
app new();
wd (ref fileobj,ref nullobj,ref nullobj,ref nullobj,
ref nullobj,ref nullobj,ref nullobj,ref nullobj,ref nullobj,
ref nullobj,ref nullobj,ref nullobj,ref nullobj,ref nullobj,
ref nullobj,ref null obj);
//獲取doc文件中的文本內(nèi)容。
foreach(中的表)
{
//遍歷每一行進行處理。
for(int k 0;k;k)
{
字符串firstContent表。Cell(k,1). range . text;
//圖紙上的數(shù)字
Regex regtsbh1新的regex (@圖中的數(shù)字。);
//匹配mcmph 1();
如果((第一內(nèi)容))
{
新Regex(@^([^
vs])。);
匹配mcTSBH2(表。Cell(k,2)());
context /*[1](),*[1](),;
}
//門牌號碼
Regex regmph1新的regex (@門牌號。);
//匹配mcmph 1();
如果((第一內(nèi)容))
{
新Regex(@^([^
vs])。);
匹配mcMPH2(表。Cell(k,2)());
context /*[1](),*[1](),;
}
//戶主
正則表達式reg hz1新正則表達式(@主啊。);
//匹配mcHZ1(表。Cell(5,1)());
如果((第一內(nèi)容))
{
新Regex(@^^([^
vs])。);
匹配mcHZ2(表。Cell(k,2)());
context /*[1](),*[1](),;
}
//
Regex regdh1 new regex (@ phone。);
//匹配mcDH1(表。Cell(6,1)());
如果((第一內(nèi)容))
{
新Regex(@^([^
vs])。);
匹配mcDH2(表。Cell(k,2)());
context /*[1](),*[1](),;
}
//樓層數(shù)
Regex reglcs1新的regex (@樓層數(shù)。);
//匹配mcLCS1(表。Cell(7,1)());
如果((第一內(nèi)容))
{
新Regex(@^([^
vs])。);
匹配mcLCS2(表。Cell(k,2)());
context /*[1](),*[1](),;
context /*[1](),*/docFileName
;
}
//文件名,用于調(diào)試。
///Regex regLCS1新regex(@^([ @([一次性]);
//匹配mcLCS1(表。Cell(7,1)());
//if((k 7 0)(k!0))
//{
// context /*[1](),*/docFileName
;
//}
}
}
}
catch(異常錯誤)
{
(錯誤:);
}
最后
{
//關(guān)閉文件
(ref nullobj,ref nullobj,ref null obj);
//關(guān)閉COM
app。Quit(ref nullobj,ref nullobj,ref null obj);
}
//返回文本內(nèi)容
返回上下文;
}