https://docs.microsoft.com/en-us/visualstudio/vsto/word-object-model-overview?view=vs-2019

Word对象的概览:

Document包含一個Range,叫做Content,

Document包含一個Paragraphs, 段落集合

Document包含一個Sections,Shapes,Tables,Words

https://stackoverflow.com/questions/38227689/office-interop-word-how-to-add-a-picture-to-document-without-getting-compressed

add a picture to document without loosing quality.

Range和Bookmark類似,但是Range只在程序運行時才會有,

好多对象都有一个类型为Range的属性,而且Range里面包含Sentences,Sections, Rows等等。

Range对象还有ShapeRange,包含特定Range里面所有的Shape对象。

Range也包含Tables,还包含Text,几乎无所不包啊。

只有Sentences接口,而没有Sentence对象。

Selection或者表示一个选择的区域(高亮)或者表示一个插入点(如果没有选中任何东西)。

1. Range.Text will reset all format, should use FormattedText property instead.

https://stackoverflow.com/questions/38571347/interop-word-range-copy-range-paste-work-slow

directly assign is ok, not use Copy as this wil use clipboard.

2. line by line read, should loop through Paragraphs as:

https://stackoverflow.com/questions/18555064/read-from-word-document-line-by-line

Paragraph.Range.Text

3. find and replace everything

doc.Selection.Find.Execute(), as:

https://stackoverflow.com/questions/19252252/c-sharp-word-interop-find-and-replace-everything

4. get all images from document

foreach(Word.InlineShape ils in this.InlineShapes)

if (ils.Type == Microsoft.Office.Interop.Word.WdInlineShapeType.wdInlineShapePicture)

5. 插入不同的格式到一行as:

Word.Paragraph oPara = oDoc.Content.Paragraphs.Add(ref oMissing);
oPara.Range.Text = "hello planet earth here's what I want to do";
object oStart = oPara.Range.Start + 13;
object oEnd = oPara.Range.Start + 18;Word.Range rBold = oDoc.Range(ref oStart, ref oEnd);
rBold.Bold = 1;

https://stackoverflow.com/questions/5628473/different-format-into-one-single-line-interop-word

6. insert image to word:

InlineShape.AddPicture as:

https://stackoverflow.com/questions/32322438/programmatically-insert-image-to-word-with-link-to-file

保留空白符序列,但是正常地进行换行。white-space: pre-wrap;

CalculateSpanWidthForTabs

ClearStyles

word.interop相关推荐

  1. 悬挂缩进 java,c#Word Interop - 设置段落缩进

    对于任何碰巧遇到这种情况的人 - 这是我如何解决的: try { // Loop through each footnote in the word doc. foreach (Footnote rn ...

  2. perl-操作ole,比如操作word

    use warnings; use strict; use Win32::OLE; my $word = CreateObject Win32::OLE 'Word.Application' or d ...

  3. The Pragmatic Programmer 读书笔记之中的一个 DRY-Don’t Repeat Youself

     The Pragmatic Programmer读书笔记之中的一个 DRY-Don't Repeat Youself 尽管自己买了非常多软件project方面的书,可是由于时间的问题.一直没有静 ...

  4. The Pragmatic Programmer 读书笔记之一 DRY-Don’t Repeat Youself

     The Pragmatic Programmer读书笔记之一 DRY-Don't Repeat Youself 虽然自己买了很多软件工程方面的书,但是因为时间的问题,一直没有静下心来充充电.最近 ...

  5. Aspose.Words导出图片 表格 Interop.Word

    先定义一个WORD 模板, 然后替换文本.域 ,定位开始表格 文本和段落 // Specify font formattingAspose.Words.Font font = builder.Font ...

  6. Word VSTO Error:Interop type 'Microsoft.Office.Interop.OneNote.Application' cannot be embedded...

    来到公司连做了几个基本MS Office Word的开发,看来我与Office有点渊源 哈哈 今天我在做Word VSTO项目是后发生了编译错误:"Interop type 'Microso ...

  7. 错误类型:“系统找不到 Microsoft.Office.Interop.Word(转)

    错误类型:"系统找不到 Microsoft.Office.Interop.Word" 编译出现错误: "Could not load file or assembly ' ...

  8. 关于.net Microsoft.Office.Interop.Word组建操作word的问题,如何控制word表格单元格内部段落的样式。...

    控制word表格单元格内部文字样式.我要将数据导出到word当中,对于word表格一个单元格中的一段文字,要设置不同的样式,比如第一行文字作为标题要居中,加粗,第二行为正常的正文. 代码如下 publ ...

  9. C# 使用Microsoft.Office.Interop将Excel、Word转换成PDF遇到的问题总结

    首先应用中引入Microsoft.Office.Interop.Excel.Microsoft.Office.Interop.Word两个dll,将嵌入式互操作类型设为False, WORD转换成PD ...

最新文章

  1. 博士买房后发现被坑,于是写万字论文维权,网友:维权界的天花板...
  2. “阿里巴巴大数据系统体系”学习笔记-纲领篇
  3. 台式电脑可以练计算机二级嘛6,练习六-计算机二级考试OFFICE高级应用试卷与试题.pdf...
  4. pytorch cross_entropy
  5. linux 760权限,Linux 文件rwx权限问题 chmod 777 XXX 任何人拥有最高权限
  6. 攻防世界-web-i-got-id-200-从0到1的解题历程writeup
  7. 对校招生培养工作的建议_如何提升人才培养质量?西华的老师们正面临一场大考...
  8. java编程思想 学习笔记(2)
  9. 转:Python: threading.local是全局变量但是它的值却在当前调用它的线程当中
  10. 有自定义控件的网站项目发布时,“不允许循环文件引用”的错误”的解决方法
  11. webstrom命名改名 命令
  12. maven报错JAVA_HOME should point to a JDK not a JRE
  13. Excel-箱线图(数据分布)分析
  14. 成语接龙快速接到“一个顶俩” (附api)
  15. Android模仿微信浮窗功能的效果实现
  16. Supervisor进程管理详解
  17. 苹果笔记本显卡性能测试软件,苹果Mac Pro性能测试:好厉害的“垃圾桶”
  18. 悟彻菩提真妙理 断魔归本合元神
  19. 新高考(3+1+2)模式下高中考试考场自动安排(Excel+VBA)
  20. 说说 Jaspersoft Studio 的主界面和报表设计视图

热门文章

  1. SystemVerilog学习笔记1 ---《数据类型》
  2. 开源版“微信”,了解一下~
  3. 旅行+社交APP功能需求分析
  4. python 操作ps脚本_python – 有没有办法以编程方式获得ps输出?
  5. OpenCV-趣味小游戏-手掌击球
  6. 第12节 DNS服务器部署与安全
  7. NPDP知识推送-第七章产品生周期管理(1)
  8. Linux/Windows快速镜像安装包下载
  9. 英雄联盟7月23日维修服务器,lol维护到几点今天 英雄联盟7月23日停机维护多长时间...
  10. 苹果怎么安装未签名的app_稳定不掉第三方app签名怎么弄