C 對Word的操作 三

2021-05-12 22:58:07 字數 1003 閱讀 6252

object start = 0;

object end = 0;

word.range tablelocation = odoc.range(ref start, ref end);

odoc.tables.add(tablelocation, 3, 4, ref omissing, ref omissing);

word.table newtable = odoc.tables[1];

object beforerow = newtable.rows[1];

newtable.rows.add(ref beforerow);

word.cell cell = newtable.cell(1, 1);

cell.merge(newtable.cell(1, 2));

object rownum = 2;

object columnnum = 2;

cell.split(ref rownum, ref columnnum);

通過段落控制插入

object omissing = system.reflection.missing.value;

object oendofdoc = "/endofdoc"; /**//* endofdoc is a predefined bookmark */

//insert a paragraph at the beginning of the document.

word.paragraph opara1;

opara1 = odoc.content.paragraphs.add(ref omissing);

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.引用裡面就增加了 object start 0 object end 0 word.range tablelocation odoc.range ref start,ref end odoc.tables.ad...

C 操作word文件(三)

1.c 呼叫word列印信封 d.printout ref missing,ref missing,ref range,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref mi...

C 對Word文件的部分操作筆記

c 對word文件的部分操作,主要是在web服務中對word進行的操作 使用的microsoft.office.interop.word.dll 12版 對office2003進行的一些操作。在進行word文件操作前先使用 using microsoft.office.interop.word 定義...