在线或通过 Android 应用程序编辑 Excel 文档
开发功能强大的基于 Android 的 Excel 文档编辑实用程序应用程序。列出使用正则表达式在 Excel 文件中搜索和替换文本的代码。
在线编辑 Excel 文档
- 通过上传来导入 Excel 文件。
- 通过注释应用程序的拖放操作单击放置区域内部即可完成此操作。
- 根据 Excel 文件的大小和互联网速度等待几秒钟。
- 键入要搜索和编辑的文本
- 输入要删除的替换文本
- 按下“删除”按钮
- 立即下载修订文件。
通过 Android 应用程序编辑 Excel 文件
- 向 android 项目添加库引用
- 使用 Workbook 类加载 Excel 文件
- 使用 getWorksheets().get(index) 获取相关工作表
- 使用 FindOptions 类并设置选项
- 遍历每个单元格并使用 putValue 更新值
- 保存 Excel 电子表格
代码:编辑 Excel 电子表格
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Workbook workbook = new Workbook(dataDir + "sourceFile.xls"); | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
CellArea area = CellArea.createCellArea("E3", "H6"); | |
FindOptions opts = new FindOptions(); | |
opts.setLookInType(LookInType.VALUES); | |
opts.setLookAtType(LookAtType.ENTIRE_CONTENT); | |
opts.setRange(area); | |
Cell cell = null; | |
do { | |
cell = worksheet.getCells().find("search", cell, opts); | |
if (cell == null) | |
break; | |
cell.putValue("replace"); | |
} while (true); | |
workbook.save(dataDir + "output.xls"); |
开发 Excel 编辑 Android 应用程序
需要开发 Excel 编辑应用程序或实用程序吗?借助
Aspose.Cells for Android via Java
(
Aspose.Total for Android via Java
的子 API),任何 Android 开发人员都可以将上述 API 代码集成到其文档编辑应用程序中。强大的 android 库允许编写任何电子表格编辑解决方案。此外,它还可以支持许多流行格式,包括 Excel 格式。