社区
C#
帖子详情
如何用c#在word中插入图片并且使图片居中显示
woto123
2011-12-13 03:37:03
看了好多帖子,实现了图片的插入,但是我想让图片居中,这个参数在哪里设置!
...全文
1090
2
打赏
收藏
如何用c#在word中插入图片并且使图片居中显示
看了好多帖子,实现了图片的插入,但是我想让图片居中,这个参数在哪里设置!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
koooky
2011-12-13
打赏
举报
回复
http://www.pconline.com.cn/pcedu/empolder/gj/vc/10305/168480.html
hefeng_aspnet
2011-12-13
打赏
举报
回复
1、 Microsoft.Office.Interop.Word.Application wordApp = new ApplicationClass()
word对象
2、 Microsoft.Office.Interop.Word.Document wordDoc = wordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing) 文档对象
3、 Object Nothing = System.Reflection.Missing.Value 常用的一个参数
4、wordApp.ActiveWindow.ActivePane.View.SeekView = WdSeekView.
wdSeekCurrentPageHeader定位到页眉
5、 wordApp.Selection.ParagraphFormat. Borders[WdBorderType.wdBorderBottom]
.LineStyle = WdLineStyle.wdLineStyleNone去掉页眉线
6、wordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument跳出页眉
7、 wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.
wdAlignParagraphCenter对齐方式(此为居中)
8、 Microsoft.Office.Interop.Word.Table policyTab = wordDoc.Tables.Add
(wordApp.Selection.Range, 行数, 列, ref Nothing, ref Nothing);创建表格
9、 wordApp.Selection.GoTo(ref oGoToItem, ref oGoToLast, ref Nothing, ref Nothing);定位页面(此为将光标定位到内容的最后)
10、 wordApp.Selection.InsertBreak(ref Nothing);插入分节符
11、 wordApp.Selection.InsertFile(nofile, ref Nothing, ref contenFalse, ref contenFalse, ref contenFalse);插入文件
12、 wordApp.Selection.InlineShapes.AddPicture(picName, ref LinkToFile, ref SaveWithDocument, ref Nothing);插入图片
13、 wordApp.ActiveWindow.ActivePane.View.SeekView = WdSeekView.
wdSeekCurrentPageFooter;定位到页脚
14、 wordApp.Selection.TypeText("此处写需要在指定位置输出的文字");文本输入
15、 wordDoc.ComputeStatistics(WdStatistic.wdStatisticPages, ref Nothing);得到页码
16、 wordDoc.PrintOut(ref Nothing, ref Nothing, ref Nothing, ref Nothing,
ref Nothing, ref Nothing, ref Nothing, ref Nothing,
ref Nothing, ref Nothing, ref Nothing, ref Nothing,
ref Nothing, ref Nothing, ref Nothing,
ref Nothing, ref Nothing, ref Nothing);
调用打印机实现打印(调用的是默认打印机)
17、 wordDoc.Close(ref saveChanges, ref Nothing, ref Nothing);文档退出
18、 wordApp.Quit(ref Nothing, ref Nothing, ref Nothing);word程序退出
C#
生成
Word
报表(插入文字、表格和图片)
回家前一个晚上,老板临时安排让写一个读取txt文件的数据和多个图片数据生成一个
word
文档。时间给得太短只能是回家继续加班,百度真是个好东西这里引用一下我参考的博客http://blog.csdn.net/jiutao_tang/article/details/6574740/ http://xuzhihong1987.blog.163.com/blog/static/26731587...
C#
- 生成
Word
文档(包含插入行,表格,图片,合并等)
转自:https://blog.csdn.net/lj102800/article/details/6106451 1.引入COM组件 在解决方案
中
“引用”->“添加引用”,在弹出的窗口
中
,选择Com选项卡,然后找到Micorsoft
Word
16.0 Object Library组件,点击确定,可以看到“引用”目录下增加了
Word
、Microsoft.Office.Core和VBID...
【
C#
】
C#
使用Microsoft.Office.Interop.
Word
操作
Word
文档,向表格
插入图片
上篇:【
C#
】
C#
使用Microsoft.Office.Interop.
Word
操作
Word
文档,替换文本
Word
模板:
C#
打开
word
进行操作,文字替换、书签处
插入图片
、读取文档
中
的表格、修改表格数据
C#
打开
word
进行操作,文字替换、书签处
插入图片
、读取文档
中
的表格、修改表格数据 public class
Word
Help { private string _JpgsPath = string.Format("{0}\\Jpgs\\", CommenPara.STR_TempPath); public void Open
Word
(string templateFile, object saveFile, ReportInfo reprortInfo,
C#
NPOI 在
Word
进行表格操作 生成表格 特定位置插入表格 合并表格 替换文字
插入图片
NPOI大多使用在Excel的导出上,
Word
导出比较少,鉴于工作需要搜罗了一下各帖子,完整用
Word
导出了多个复杂表格,现在根据最近的工作做一下总结。
C#
111,129
社区成员
642,541
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章