Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 读取c语言中的word文档并将数据存储在sql server中_C#_Asp.net - Fatal编程技术网

C# 读取c语言中的word文档并将数据存储在sql server中

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

我的要求是这样的

我有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               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。在下面的示例链接中找到解决方案的部分:。但您必须设计自己的解析逻辑。