引用Aspose.Words.dll 对word文档进行操作
1.插入纵页或者横页
Document doc = new Document(tempFile);
DocumentBuilder builder = new DocumentBuilder(doc);
插入分页符:
builder.InsertBreak(BreakType.SectionBreakNewPage);
builder.InsertBreak(BreakType.PageBreak);
以上都是插入分页符,这里就介绍2种。
设置纸张大小:
builder.PageSetup.PaperSize = PaperSize.A4;
插入纵页:
builder.PageSetup.Orientation = Aspose.Words.Orientation.Portrait;
插入横页:
builder.PageSetup.Orientation = Aspose.Words.Orientation.Landscape;
插入图片:
①builder.InsertImage(file, RelativeHorizontalPosition.Page, 90, RelativeVerticalPosition.Line, 0, 640, 350,WrapType.Square);
②builder.InsertImage(file); //file是图片路径,由于插入图片有12个方法,我这里就举2个了。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)