Hi
I’m trying to load the example Excel file in Groupdocs.Viewer 3.7.2 but there¿s an exception. This is my code (Running on Wildfly 8.1.0) :
private Response getDocumentInfo(final File file) {
File temp = new File(file.getParent(), “tmp”);
ViewerConfig config = getConfig(temp, file);
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
HtmlOptions options = new HtmlOptions();
options.setResourcesEmbedded(true);
options.getCellsOptions().setOnePagePerSheet(true);
Map<String, Object> info = new HashMap<>();
try {
DocumentInfoContainer documentInfo = htmlHandler.getDocumentInfo(file.getAbsolutePath());
int pageCount = documentInfo.getPages().size();
info.put(“pageCount”, pageCount);
if (pageCount > 0) {
info.put(“pageWidth”, documentInfo.getPages().get(0).getWidth());
info.put(“pageHeight”, documentInfo.getPages().get(0).getHeight());
info.put(“documentType”, documentInfo.getDocumentType());
info.put(“fileType”, documentInfo.getFileType());
info.put(“extension”, documentInfo.getExtension());
info.put(“name”, documentInfo.getName());
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
return Response.serverError().build();
}
return Response.ok().entity(info).build();
}
File temp = new File(file.getParent(), “tmp”);
ViewerConfig config = getConfig(temp, file);
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
HtmlOptions options = new HtmlOptions();
options.setResourcesEmbedded(true);
options.getCellsOptions().setOnePagePerSheet(true);
Map<String, Object> info = new HashMap<>();
try {
DocumentInfoContainer documentInfo = htmlHandler.getDocumentInfo(file.getAbsolutePath());
int pageCount = documentInfo.getPages().size();
info.put(“pageCount”, pageCount);
if (pageCount > 0) {
info.put(“pageWidth”, documentInfo.getPages().get(0).getWidth());
info.put(“pageHeight”, documentInfo.getPages().get(0).getHeight());
info.put(“documentType”, documentInfo.getDocumentType());
info.put(“fileType”, documentInfo.getFileType());
info.put(“extension”, documentInfo.getExtension());
info.put(“name”, documentInfo.getName());
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
return Response.serverError().build();
}
return Response.ok().entity(info).build();
}
The exception is:
<pre class=“aLF-aPX-K0-aPE aLF-aPX-aLK-ayr-auR” style=“user-select: text; font-family: “Courier New”, Courier, monospace, arial, sans-serif; font-size: 14px; margin-top: 0px; margin-bottom: 0px; white-space: pre-wrap; word-wrap: break-word; background-color: rgb(255, 255, 255);”>(default task-6) Index: 0, Size: 0: class com.groupdocs.viewer.exception.GroupDocsViewerException: Index: 0, Size: 0
com.groupdocs.viewer.converter.a.g.bKo(Unknown Source)
com.groupdocs.viewer.helper.c.c(Unknown Source)
com.groupdocs.viewer.helper.c.b(Unknown Source)
com.groupdocs.viewer.handler.ViewerHandler.d(Unknown Source)
com.groupdocs.viewer.handler.ViewerHandler.a(Unknown Source)
com.groupdocs.viewer.handler.ViewerHandler.getDocumentInfo(Unknown Source)
com.groupdocs.viewer.handler.ViewerHandler.getDocumentInfo(Unknown Source)
com.macroproyectos.forest.viewer.ViewerResource.getDocumentInfo(ViewerResource.java:199)
com.macroproyectos.forest.viewer.ViewerResource.loadDocument(ViewerResource.java:123)
com.macroproyectos.forest.viewer.ViewerResource$Proxy$_$$_WeldClientProxy.loadDocument(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:497)
com.groupdocs.viewer.converter.a.g.bKo(Unknown Source)
com.groupdocs.viewer.helper.c.c(Unknown Source)
com.groupdocs.viewer.helper.c.b(Unknown Source)
com.groupdocs.viewer.handler.ViewerHandler.d(Unknown Source)
com.groupdocs.viewer.handler.ViewerHandler.a(Unknown Source)
com.groupdocs.viewer.handler.ViewerHandler.getDocumentInfo(Unknown Source)
com.groupdocs.viewer.handler.ViewerHandler.getDocumentInfo(Unknown Source)
com.macroproyectos.forest.viewer.ViewerResource.getDocumentInfo(ViewerResource.java:199)
com.macroproyectos.forest.viewer.ViewerResource.loadDocument(ViewerResource.java:123)
com.macroproyectos.forest.viewer.ViewerResource$Proxy$_$$_WeldClientProxy.loadDocument(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:497)
I’m attaching the sample Excel as well. Thanks for your attention.