C# 读取c语言中的word文档并将数据存储在sql server中
我的要求是这样的 我有word文档,其格式如下:C# 读取c语言中的word文档并将数据存储在sql server中,c#,asp.net,C#,Asp.net,我的要求是这样的 我有word文档,其格式如下: > 1. this is test doc. > 1.1 this is test doc1.1 > 1.1.1 this is test doc 1.1.1 > 1.2 this is test doc 1.2 > 1.2.1 this is test doc 1.2.1 现在,我想读取文档数据并存储在我的sql中。我的桌子是这样的: > ID requirement
> 1. this is test doc.
> 1.1 this is test doc1.1
> 1.1.1 this is test doc 1.1.1
> 1.2 this is test doc 1.2
> 1.2.1 this is test doc 1.2.1
现在,我想读取文档数据并存储在我的sql中。我的桌子是这样的:
> ID requirement parentid
>
> 1 this is test doc 0
2 this is test doc1.1 1
3 this is test doc 1.1.1 2
4 this is test doc 1.2 1
5 this is test doc 1.2.1 4
因此,是否可以从文档中读取数据并保存在sql server中。在sql server 2008中,我们有hierarchyid数据类型。 请查找下面描述新数据类型及其用法的链接 我认为这将使解决方案的实施更加容易。当word文档有节-子节-子节,如1、1.1、1.1.1等时,我可以将其与层次结构联系起来 链接为:
希望这能有所帮助。尝试以下.docx file Office 2007及更高版本的链接解决方案;OpenXML格式-是的,这些是压缩的XML片段,您使用的是SQL server版本?但我如何从word文件中读取数据。这在任何链接中都没有提到。@Suresh:如果您在中选择层次结构Id,您的DB结构将发生一定程度的变化,因为我认为您不需要父Id列。接下来是如何阅读文档。您可以尝试在.net Framework中使用Interop.Office DLL。在下面的示例链接中找到解决方案的部分:。但您必须设计自己的解析逻辑。