前提:
匯入com庫:microsoft word 11.0 object library.
引用裡面就增加了:
建立新word
object
newtrue
;odoc = oword.documents.add(
refomissing,
refomissing,
refomissing,
refomissing);
開啟文件:
object
newtrue
;object
filename = @"e:/cccxcxx/testdoc.doc";
odoc = oword.documents.open(
reffilename,
refomissing,
refomissing,
refomissing,
refomissing,
refomissing,
refomissing,
refomissing,
refomissing,
refomissing,
refomissing,
refomissing,
refomissing,
refomissing,
refomissing,
refomissing);
匯入模板
object
newtrue
;object
filename = @"e:/***ccx/test.doc";
odoc = oword.documents.add(
reffilename,
refomissing,
refomissing,
refomissing);
.新增新錶
object
newtrue
;odoc = oword.documents.add(
refomissing,
refomissing,
refomissing,
refomissing);
object
start = 0;
object
end = 0;
word.range tablelocation = odoc.range(
refstart,
refend);
odoc.tables.add(tablelocation, 3, 4,
refomissing,
refomissing);
.表插入行
object
newtrue
;odoc = oword.documents.add(
refomissing,
refomissing,
refomissing,
refomissing);
object
start = 0;
object
end = 0;
word.range tablelocation = odoc.range(
refstart,
refend);
odoc.tables.add(tablelocation, 3, 4,
refomissing,
refomissing);
word.table newtable = odoc.tables[1];
object
beforerow = newtable.rows[1];
newtable.rows.add(
refbeforerow);
.單元格合併
object
newtrue
;odoc = oword.documents.add(
refomissing,
refomissing,
refomissing,
refomissing);
object
start = 0;
object
end = 0;
word.range tablelocation = odoc.range(
refstart,
refend);
odoc.tables.add(tablelocation, 3, 4,
refomissing,
refomissing);
word.table newtable = odoc.tables[1];
object
beforerow = newtable.rows[1];
newtable.rows.add(
refbeforerow);
word.cell cell = newtable.cell(1, 1);
cell.merge(newtable.cell(1, 2));
.單元格分離
object
newtrue
;odoc = oword.documents.add(//endofdoc";
/* /endofdoc is a predefined bookmark */
//start word and create a new document.
newtrue
;odoc = oword.documents.add(
refomissing,
refomissing,
refomissing,
refomissing);
//insert a paragraph at the beginning of the document.
word.paragraph opara1;
opara1 = odoc.content.paragraphs.add(
refomissing);
opara1.range.text = "heading 1";
opara1.range.font.bold = 1;
opara1.format.spaceafter = 24;
//24 pt spacing after paragraph.
opara1.range.insertparagraphafter();
C 操作Word完全方法
前提 匯入com庫 microsoft word 11.0 object library.引用裡面就增加了 建立新word objectomissing system.reflection.missing.value word.document odoc oword.visible true odo...
拒絕藍屏 宕機 電腦維護完全功略
電腦用了一段時間後,程式的執行速度越來越慢,不時還出現藍屏 宕機等現象,電腦執行時的噪音也越來越大 心愛的電腦再也沒有當初的顏色了,這到底是怎麼回事?這主要是你沒有進行電腦維護。電腦也需要定期的進行電腦維護,這樣才能保證它正常執行。如果你不知道如何來電腦維護,一起來做吧。電腦維護 清潔硬體 電腦使用...
c 操作word文件
最近由於工作需要,做了一些關於c 操作word文件方面的工作 主要是對word中 的操作,以下是部分 關於操作不規則 的 using system using system.collections using system.componentmodel using system.data using...