如何将 xlsx (office 2007) 文件保存为 XML 文件格式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4524609/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to save xlsx (office 2007) file as XML file format
提问by Kammy
I am trying to save office 2007 xlsx file to xml file format so that i can read it programmatically.
我正在尝试将 office 2007 xlsx 文件保存为 xml 文件格式,以便我可以以编程方式读取它。
While saving xlsx file as xml it gives error "Cannot save XML data bcoz workbook doesnt content XML mapping."
将 xlsx 文件保存为 xml 时,会出现错误“无法保存 XML 数据 bcoz 工作簿不包含 XML 映射。”
I have found that I need to add XML mapping first and then It is possible. On Office 2007 site they have mentioned that first import xsd file for XML mapping and then it can be saved as XML file format.
我发现我需要先添加XML映射然后才可以。在 Office 2007 站点上,他们提到首先导入 xsd 文件进行 XML 映射,然后可以将其保存为 XML 文件格式。
So Please anyone tell me how to create xsd file from xlsx file.
所以请任何人告诉我如何从 xlsx 文件创建 xsd 文件。
Also tell me what could be done to save file as xml file other than this approach.
还请告诉我除了这种方法之外,还可以做些什么来将文件另存为 xml 文件。
Note: I could not use any external tool to convert xlsx to xml because User have to create file xml file using "save as".
注意:我无法使用任何外部工具将 xlsx 转换为 xml,因为用户必须使用“另存为”创建文件 xml 文件。
I was using Convert xls of softinterface which convert xlsx file to xml office 2007 format. But this software is can work on windows only. My server is Linux.
我正在使用 softinterface 的 Convert xls,它将 xlsx 文件转换为 xml office 2007 格式。但是这个软件只能在windows上运行。我的服务器是Linux。
回答by Codo
The easiest way is probably to instruct your users to save it in the "XML Spreadsheet 2003" format. That XML format is easy to understand and straightforward for further processing.
最简单的方法可能是指示您的用户将其保存为“XML Spreadsheet 2003”格式。这种 XML 格式易于理解,而且易于进一步处理。
With that format, you don't need not XML mapping, no schema file etc.
使用这种格式,您不需要 XML 映射,不需要架构文件等。

