spire.doc支持对word章节(section)进行分栏,本文介绍如何对一个现成的文档进行分栏以及设置分割线。
添加分栏
c#
//加载源文档
document doc = new document();
doc.loadfromfile("samplewordfile.docx");
//获取第二节
section section = doc.sections[1];
//设置分栏
section.addcolumn(150, 10);
//保存文档
doc.savetofile("添加分栏.docx", fileformat.docx2013);
vb.net
dim doc as document = new document
doc.loadfromfile("samplewordfile.docx")
dim section as section = doc.sections(1)
section.addcolumn(150!, 10!)
doc.savetofile("添加分栏.docx", fileformat.docx2013)
添加分栏及分割线
c#
//加载源文档
document doc = new document();
doc.loadfromfile("samplewordfile.docx");
//获取第二节
section section = doc.sections[1];
//设置分栏
section.addcolumn(150, 10);
//添加分栏线
section.pagesetup.columnslinebetween = true;
//保存文档
doc.savetofile("添加分栏及分割线.docx", fileformat.docx2013);
vb.net
dim doc as document = new document
doc.loadfromfile("samplewordfile.docx")
dim section as section = doc.sections(1)
section.addcolumn(150!, 10!)
section.pagesetup.columnslinebetween = true
doc.savetofile("添加分栏及分割线.docx", fileformat.docx2013)