OpenXml读取word内容注意事项
OpenXml读取word内容注意事项
1、使用OpenXml读取word内容,word后缀必须是".docx";如果word后缀是".doc"需要转成".docx"后,才可以读取;
2、需要引入相关dll;"WindowsBase.dll"、“DocumentFormat.OpenXml.dll”;
3、word大小>0字节(word大小为0字节会报错);
word内容
相关代码

static void Main(string[] args) { string wordPathStr = @"C:\Users\user\Desktop\新建文件夹 (2)\5.docx"; using (WordprocessingDocument doc = WordprocessingDocument.Open(wordPathStr, true)) { Body body = doc.MainDocumentPart.Document.Body; foreach (var paragraph in body.Elements<Paragraph>()) { Console.WriteLine(paragraph.InnerText); } } Console.ReadLine(); }

控制台显示
OpenXml读取word内容注意事项的更多相关文章
- OpenXml读取word内容(一)
OpenXml读取word内容注意事项 1.使用OpenXml读取word内容,word后缀必须是".docx":如果word后缀是".doc"需要转成&quo ...
- OpenXml读取word内容(二)
注意事项 上一篇已经说明,这次就不一一说了,直接来正文: word内容 相关代码 方法1 static void Main(string[] args) { string wordPathStr = ...
- OpenXml读取word内容(三)
内容和表格内容一起读: word内容: 代码: public static void ReadWordByOpenXml(string path) { using (WordprocessingDoc ...
- java读取word内容
暂时只写读取word内容的方法. 依赖的jar: poi-3.9-20121203.jarpoi-ooxml-3.9-20121203.jarxmlbeans-2.3.0.jar package co ...
- python如何转换word格式、读取word内容、转成html
# python如何转换word格式.读取word内容.转成html? import docx from win32com import client as wc # 首先将doc转换成docx wo ...
- C#读取word内容实践
C#读取word文档是如何实现的呢?我们可以使用FileStream对象来把文本文件里面的信息读取出来,但是对于word文档来说就不能使用这样的方法了. 这种情况下C#读取word文档的实现我们需要使 ...
- c#读取word内容,c#提取word内容
Post by 54admin, 2009-5-8, Views:575 1: 对项目添加引用,Microsoft Word 11.0 Object Library 2: 在程序中添加 using W ...
- C# 读取Word内容控件
在Word中,借助内容控件,可设计出具有特定功能的文档或模板.以下表格中简单介绍了几种常用的内容控件. 名称 简介 下拉列表内容控件 下拉列表包含了一个预先定义好的列表.和组合框不同的是下拉列表不允许 ...
- 我的第八个java程序--读取word内容
package World; import java.io.FileNotFoundException; import java.io.IOException; import org.apache.p ...
随机推荐
- waf bypass
1.前言 去年到现在就一直有人希望我出一篇关于waf绕过的文章,我觉得这种老生常谈的话题也没什么可写的.很多人一遇到waf就发懵,不知如何是好,能搜到的各种姿势也是然并卵.但是积累姿势的过程也是迭代的 ...
- 附1 hystrix详述(1)
一.hystrix的作用 控制被依赖服务的延时和失败 防止在复杂系统中的级联失败 可以进行快速失败(不需要等待)和快速恢复(当依赖服务失效后又恢复正常,其对应的线程池会被清理干净,即剩下的都是未使用的 ...
- [置顶] 一道经典的sql面试题不同的写法
用一条SQL语句 查询出每门课都大于80分的学生姓名,表( #test)如下: Name Course Mark 张三 语文 81 张三 数学 75 李四 语文 76 李四 数学 90 王五 ...
- 15 款JavaScript 热门图形图表库
图表是数据图形化的表示,也就是“通过形象的图表来展示数据,比如条形图,折线图,饼图”.几乎每个开发或者项目管理团队都需要图表或者图形来简化 理解,可视化复杂的数据和 web 应用工作流.可视化图表可以 ...
- iphone手机微信端html5 Geolocation定位失效的问题
使用Geolocation方法存在错误信息error.POSITION_UNAVAILABLE 其实问题不局限于微信端而是iphone升级到ios10后,对获取地理位置信息作出了限制,只有https的 ...
- iframe多层嵌套时获取元素
一.同域:1.父页面获取子页面元素:注意:onload事件jQuery获取:$("iframe").contents().find("holder")..... ...
- Learning How To Code Neural Networks
原文:https://medium.com/learning-new-stuff/how-to-learn-neural-networks-758b78f2736e#.ly5wpz44d This i ...
- 拼接多个 wchar_t *
/* wcscat example */ #include <wchar.h> int main () { wchar_t wcs[80]; wcscpy (wcs,L" ...
- Linux清理磁盘空间
1.首先确定是否是磁盘满了 命令: df -h 参数说明: -a:列出所有的文件系统,包括系统特有的/proc等文件系统 -k:以KB的容量显示各文件系统 -m:以MB的容量显示各文件系统 -h: ...
- HttpContext.Current.Cache 和 HttpRuntime.Cache
HttpRuntime.Cache:用于winfrom 和 web HttpContext.Current.Cache 用于web .NET中Cache有两种调用方式:HttpContext.Curr ...