如何在 Java 中读取和附加 .xlsm 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30296189/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 16:50:21  来源:igfitidea点击:

How to read and append a .xlsm file in java

javafilexlsm

提问by Vandhana

I want to read and append a .xlsm file in java. I dont have any idea on how to do it. Do i need to download any jar file to work with it? All the search result provides a solution which uses apache poi(I did not get what it is). I dont use any IDE. Using simple FileReader and other logic can't I work with this type of file?

我想在 java 中读取并附加一个 .xlsm 文件。我不知道该怎么做。我需要下载任何 jar 文件才能使用它吗?所有的搜索结果都提供了一个使用 apache poi 的解决方案(我没有得到它是什么)。我不使用任何 IDE。我不能使用简单的 FileReader 和其他逻辑来处理这种类型的文件吗?

Please give me a clear idea on what is a .xlsm file and how to work with it using java.

请让我清楚地了解什么是 .xlsm 文件以及如何使用 java 使用它。

采纳答案by Kenneth Clark

"XLSM is a Microsoft Excel macro-enabled spreadsheet that contains worksheets of cells arranged by rows and columns and embedded macros programmed in the Visual Basic for Applications language. XLSM files are like XLSX files, but with macros enabled. They can be opened with Excel 2007 or later, or by previous versions of Excel with Open XML component support."

"XLSM 是一个 Microsoft Excel 启用宏的电子表格,其中包含按行和列排列的单元格工作表以及在 Visual Basic for Applications 语言中编程的嵌入式宏。XLSM 文件类似于 XLSX 文件,但启用了宏。它们可以用 Excel 打开2007 或更高版本,或者早期版本的 Excel 支持 Open XML 组件。”

You can read and write to the file using Apache poi.

您可以使用 Apache poi 读取和写入文件。

Take a look at the following SO Posts

看看下面的SO帖子

write to xlsm (Excel 2007) using apache poi

使用 apache poi 写入 xlsm (Excel 2007)

Read data from read only xlsm file using Java Apache POI

使用 Java Apache POI 从只读 xlsm 文件中读取数据

The Apache POI documentation is located at https://poi.apache.org/

Apache POI 文档位于 https://poi.apache.org/