现在的位置: 首页 > 综合 > 正文

[C#]用C#动态生成Word文档并将数据填入Word表格中(续)

2017年11月19日 ⁄ 综合 ⁄ 共 614字 ⁄ 字号 评论关闭

再补充一些关于C#动态生成Word文档的操作

WordDoc.PageSetup.Orientation = Word.WdOrientation.wdOrientLandscape;//页面设置为横向

WordApp.Selection.ParagraphFormat.SpaceAfter 
= 10f;//段后距离

WordApp.Selection.TypeText(
"产品材料表");//在光标处写入信息

//插入图片 方法2
string FileName = Picture;
object LinkToFile = false;
object SaveWithDocument = true;
object Anchor = WordDoc.Tables[1].Cell(7, p).Range;//设置插入位置 // WordDoc.Application.Selection.Range;
object Left = 5;
object Top = 5;
object Width = 90;
object Height = 90;
WordDoc.Application.ActiveDocument.Shapes.AddPicture(FileName, 
ref LinkToFile, ref SaveWithDocument,ref Left,ref Top,ref Width,ref Height, ref Anchor);

抱歉!评论已关闭.