我正在开发一个项目,该项目需要读取Excel工作簿,调用必要的Web服务,然后从Web服务获取响应并将该信息输入到已读取的同一Excel工作簿中.
这是我在尝试写入Excel工作簿时看到的错误:
Exception in thread "main" org.apache.poi.POIXMLException: java.io.IOException: Can't obtain the input stream from /docProps/app.xml
at org.apache.poi.POIXMLDocument.getProperties(POIXMLDocument.java:141)
at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:177)
at ext.ExcelProcessor.main(ExcelProcessor.java:197)
Caused by: java.io.IOException: Can't obtain the input stream from /docProps/app.xml
at org.apache.poi.openxml4j.opc.PackagePart.getInputStream(PackagePart.java:500)
at org.apache.poi.POIXMLProperties.<init>(POIXMLProperties.java:75)
at org.apache.poi.POIXMLDocument.getProperties(POIXMLDocument.java:139)
... 2 more
Run Code Online (Sandbox Code Playgroud)
这是我打开文件/阅读的代码:
pkg = OPCPackage.open(xslFile);
theWorkbook = new XSSFWorkbook(pkg);
Run Code Online (Sandbox Code Playgroud)
在此之后,我读取每一行并提取每个单元格值.
完成此操作后,我将在Success和Result Message的标题下创建单元格,然后执行以下操作:
String sessionData = sessionKey[1];
String[] cellValCurrRow = rowCellVals.get(r-1);
String attachmentData[] = WQSServices.uploadAttachment(sessionData, cellValCurrRow);
XSSFCell cell = xslRows[r].getCell(7);
if(cell == null)
{
cell = xslRows[r].createCell(7);
}
System.out.println("The Cell: "+cell.getStringCellValue());
XSSFCell …Run Code Online (Sandbox Code Playgroud) 当用户从表单输入中选择图像时,我正在寻找一种方法来更改div背景图像.如下所示,我有一个输入类型的文件.一旦用户选择了他们想要的文件,我希望div#imgHolder根据所选文件更改背景.有什么想法吗?
<div id="simpleDialog" style="width: 350px; height: 350px; display:none;" scrolltop="0">
<br>
<div id="imgHolder" style="width:200px;height:200px;background-image: url(images/gray.png)"></div>
<br>
<form id="userForm" align="center">
<fieldset>
<legend>Artist Info</legend>
<input type="file" name="artistImage" id="artistImage" style="border: none;float:left"><br><br>
<label for="text" style="float:left">Enter URL:</label>
<input type="text" name="website" id="website" value="" required="required">
</fieldset>
</form>
<input type="button" id="submit" value="Submit" />
<input type="button" id="cancel" value="Cancel" />
</div>
Run Code Online (Sandbox Code Playgroud) 我已经创建了一个Canvas并且已经成功地写出了一个带有X和Y坐标的网格(类似于方格纸).我现在要做的是以下内容:
- 当有人用鼠标点击时,网格中的正方形将变为不同的颜色 -
一旦选择了一个块,数据就不会改变
目前我有一个机制可以检查系统中的文件。如果某些内容尚未修改,则不会将其签入文档管理系统。不幸的是,我现在在这个过程中一直在压缩和解压缩文件,任何解压缩/压缩的文件都有一个新的修改日期,而不是对象的实际修改日期。
无论如何,与打包相比,Java 是否可以确定上次打开和修改文件的实际时间?
谢谢!
我正在使用的专有程序在解压缩时拉上并提取某些文件而不更改文件的修改日期.我也根据我们程序中的源代码创建自己的zip和提取工具但是当我解压缩文件时,所有压缩文件的修改日期显示为解压缩时间和日期.这是我提取的代码:
public static int unzipFiles(File zipFile, File extractDir) throws Exception
{
int totalFileCount = 0;
String zipFilePath = zipFile.getPath();
System.out.println("Zip File Path: " + zipFilePath);
ZipFile zfile = new ZipFile(zipFile);
System.out.println("Size of ZipFile: "+zfile.size());
Enumeration<? extends ZipEntry> entries = zfile.entries();
while (entries.hasMoreElements())
{
ZipEntry entry = entries.nextElement();
System.out.println("ZipEntry File: " + entry.getName());
File file = new File(extractDir, entry.getName());
if (entry.isDirectory())
{
System.out.println("Creating Directory");
file.mkdirs();
}
else
{
file.getParentFile().mkdirs();
InputStream in = zfile.getInputStream(entry);
try
{
copy(in, file);
}
finally
{
in.close(); …Run Code Online (Sandbox Code Playgroud)