- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我找到了一种在 ODF 文件中存储自定义文件的方法,方法是将它们存储在新的资源目录中,并将其包含在新 mimetype 下的 list 中。
我想知道如何在我的 Java OpenOffice 插件中完成以下任务:
关于如何实现这一目标的任何想法。我是 UNO API 的新手,有点困惑。
最佳答案
/* this java code need one jar file named with odfdom-java 0.8.6 , and it will able to read any odt file and can store in string and can also change the content of the original file on new or existing file what ever your requirement . if you want to create new file then give new file name and path at the method "document.save("D:/newFile.odt")".
*/
1)--> FileReaderTemp .java
package com.ik.candidate.util;
import java.io.File;
import org.apache.log4j.Logger;
import org.odftoolkit.odfdom.doc.OdfTextDocument;
import org.odftoolkit.odfdom.incubator.search.TextNavigation;
import org.odftoolkit.odfdom.incubator.search.TextSelection;
public class FileReaderTemp {
public static void main(String[] args) throws Exception {
parseAll("d:/odt_resume/vrunda_ashar_Rajkot_00.odt");
}
public static void parseAll(String fileName) throws Exception {
Logger logger = Logger.getLogger(FileReaderTemp.class);
try {
File file = new File(fileName);
if (!file.exists()) {
logger.debug("Sorry File does not Exists!");
} else if (file.getName().endsWith(".odt")) {
OpenOfficeParser odt = new OpenOfficeParser();
//getting contents of odt file in string
String string = odt.getText(fileName);
TextNavigation search;
OdfTextDocument document = (OdfTextDocument) OdfTextDocument.loadDocument(fileName);
// for replacing Email id
String emailID="jariya.nilesh99@gmail.com";
// String emailID = new FindEmailID().findEmail(string);
System.out.println("Email is :: " + emailID);
search = new TextNavigation(emailID, document);
while (search.hasNext()) {
System.out.println("Search is : " + search);
TextSelection item = (TextSelection) search.getCurrentItem();
item.replaceWith("");
System.out.println("Email id Removed succesfully :: ");
}
// for replacing contact no
String no="9856565698";
//String no = new FindContactNo().findContact(string);
System.out.println("Contact no is :: " + no);
no = no.replace("+", "");
// System.out.println("After removed + : " + no);
search = new TextNavigation(no, document);
// iterate through the search results
while (search.hasNext()) {
// System.out.println("Search is No : " + search);
TextSelection item = (TextSelection) search.getCurrentItem();
item.replaceWith("");
System.out.println("Contact no Removed succesfully :: ");
}
// save the modified document back to a original file other wise it will create new odt file
document.save(fileName);
}
}
catch (Exception e) {
//logger.error("Exception : " + e);
System.out.println("Not found ::");
}
}
}
关于java - 如何使用 Java 和 OpenOffice UNO API 操作 odt 文件中的嵌入文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5199254/
我想在我的 OpenOffice writer-document 中放置一个“签名字段”。 我需要 iOS/gPlay 应用程序 "PDF Forms"在触摸屏上签署 PDF 文档(手写/笔)。 根据
我已经以动态填充的Libre / OpenOffice Base形式获得了表控件。 我想更改其高度以匹配行数。 怎么做? 我已经尝试更改getSize() / setSize()和height属性,但
我在 Calc 电子表格中有几个数据列,每个列有 400 到 500 个条目。对于这些列中的每一列,我只想简单地找到均值和标准差,但不知道如何进行。 有人可以用简单而非技术性的语言逐步指导我如何做到这
我有两列有数字。当另一个有重复时,另一个只有一次数字。这些列中的数字不匹配。我需要在 B 列中找到在 A 列中匹配的所有数字。 这可能更好地解释了它: 甲乙 1 2 2 2 4 5 6 5 7 6 8
我想为 Calc 编写一个返回 #VALUE 的 Basic 函数!可使用 ISERR() 进行测试。 Function foo() foo = #VALUE! End Function 但是
我知道 OpenOffice.org 中的风格 .... 但 我想要与 HTML 样式相同的内联样式, 喜欢 (类似的东西)......这可能吗? 如果你知道这样的例子或文章,请引用我。 最佳答案
我正在尝试将 openOffice 作为 CentOS(非图形)服务器上的服务启动。 soffice -headless -nologo -nofirststartwizard -accept="so
有没有办法像在其他语言中一样在 OpenOffice Basic 中继续循环? For i = 0 To 10 If i = 5 Then Continue For # Not work
我正在尝试使用 OpenOffice 在 WinXP MSVC 2008.NET 上编写一个简单的“Hello World”窗口3.0 API和SDK。 这篇文章对于初学者来说很重要... http:
基本上,我希望 LibreOffice Calc 做我告诉它的,而不是它想要的。 例如: 当我输入 1.1.12 时,我想在那个单元格中有 1.1.12,而不是 01.01.2012 或其他什么。 当
让我们看看这个例子: 我有 HTML 标记的文本: Example text 我有 *.odt(OpenDocument 文本)文档,我想在其中放置此 HTML 文本,其格式取决于 HTML 标签(在
有没有什么方法可以在 linux 上将 odt 文档转换为 doc 或 rtf 而不使用 openoffice 或任何依赖于安装 openoffice 的库? 最佳答案 OpenOffice.org
我想过滤掉特定列上具有特定颜色的行。我尝试几乎到处搜索但找不到答案。希望大家给点好的建议,谢谢。 最佳答案 据我所知,目前没有内置函数允许根据单元格的格式选择单元格。但在 this OOo forum
我需要使用 OpenOffice Java API 复制文档部分并将其粘贴到另一个文档部分。到目前为止,我已经设法复制源文档部分的文本并将其粘贴到目标文档的部分(参见下面的示例)。 但是,问题是非文本
我有一个小问题,我需要计算控制台内的字数才能阅读 doc、docx、pptx、ppt、xls、xlsx、odt、pdf ......所以不要建议我 | wc -w 或 grep 因为它们只适用于文本或
是否可以将单元格的内容放在公式中。我所说的公式是指数学公式编辑器(插入-> 对象-> 公式)。 最佳答案 据我所知,无法从公式中引用单元格。数学公式编辑器对 OO Calc 一无所知。但是,您可以在需
在第一张原始数据和第二张修改数据中,如果 sheet1 和 sheet2 数据不匹配,我想比较两个工作表数据并用颜色标记。 我有两个不同的工作表,数据如下。 工作表 1: --------A-----
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 5年前关闭。 Improve thi
我编辑了一个来自客户的文档,其中有一些亮点,然后决定删除评论中的亮点。 无论出于何种原因,该文档突出显示了许多项目符号和编号列表部分,当我尝试选择整个文档并将突出显示更改为“无填充”时,我无法还原这些
我是 Calc 的新手,但我是 Excel 的老手。不幸的是,我没有后者。我正在尝试使用我需要使用的数据创建一个新的单元格,如下所示 AF Afghanistan AL Albania D
我是一名优秀的程序员,十分优秀!