Content detection question (1619)

Hello,

I have an issue with diagram content detection which returns true for following code:

System.out.println(FileFormatUtil.detectFileFormat("test.txt").getLoadFormat() == com.aspose.diagram.FileFormatType.VDX);

I’m wondering, should I use similar approach to the one suggested here for excel content detection?

System.out.println(FileFormatUtil.detectFileFormat("test.txt").getFileFormatType() == com.aspose.diagram.FileFormatType.VDX);

If I do, should I use it for VSD and VSDX format detection as well?

Regards, Zeljko

test.txt.zip (180 Bytes)

@Zeljko,

Please try the following lines of code:
Java

String dataDir = "C:\\Diagram\\test2389\\";
com.aspose.diagram.FileFormatInfo info = com.aspose.diagram.FileFormatUtil.detectFileFormat(dataDir + "test.txt");
// Get the detected file format
System.out.println(info.getFileFormatType() == com.aspose.diagram.FileFormatType.VDX);

Thanks @imran.rafique.

Please let me know should I do the similar for VSD and VSDX, like

System.out.println(com.aspose.diagram.FileFormatUtil.detectFileFormat(pathToFile).getFileFormatType() == com.aspose.diagram.FileFormatType.VSD)
System.out.println(com.aspose.diagram.FileFormatUtil.detectFileFormat(pathToFile).getFileFormatType() == com.aspose.diagram.FileFormatType.VSDX)

?

Best, Zeljko

Please note also that I am facing issues with the proposed way of VDX detection.

Here is the code sample:

@Test
public void vdxDetectionTest() throws Exception {
java.io.File file = new java.io.File("test.resx");
com.aspose.diagram.FileFormatInfo fileFormatInfo = com.aspose.diagram.FileFormatUtil.detectFileFormat(file.getAbsolutePath());
assertFalse(fileFormatInfo.getFileFormatType() == com.aspose.diagram.FileFormatType.VDX);

file = new File("test.xlf");
fileFormatInfo = com.aspose.diagram.FileFormatUtil.detectFileFormat(file.getAbsolutePath());
assertFalse(fileFormatInfo.getFileFormatType() == com.aspose.diagram.FileFormatType.VDX);

file = new File("test.mqxliff");
fileFormatInfo = com.aspose.diagram.FileFormatUtil.detectFileFormat(file.getAbsolutePath());
assertFalse(fileFormatInfo.getFileFormatType() == com.aspose.diagram.FileFormatType.VDX);

file = new File("test.inx");
fileFormatInfo = com.aspose.diagram.FileFormatUtil.detectFileFormat(file.getAbsolutePath());
assertFalse(fileFormatInfo.getFileFormatType() == com.aspose.diagram.FileFormatType.VDX);
}

Files:
test.zip (56.8 KB)

@Zeljko,

Yes, you can follow the same approach for all listed formats in this text file: formats.zip (425 Bytes)

We managed to replicate the problem of incorrect file format detection. It has been logged under the ticket ID DIAGRAMJAVA-50597 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

Thanks Imran.

I found another file with the same issue, please at it to the ticket you just logged in your bug tracking system.

java.io.File file = new java.io.File("test.icml");
com.aspose.diagram.FileFormatInfo fileFormatInfo = com.aspose.diagram.FileFormatUtil.detectFileFormat(file.getAbsolutePath());
assertFalse(fileFormatInfo.getFileFormatType() == com.aspose.diagram.FileFormatType.VDX);

test.icml.zip (25.8 KB)

@Zeljko,

The linked ticket ID DIAGRAMJAVA-50597 has been resolved and will be included in the next version 18.4 of Aspose.Diagram for Java API. We will notify you once it is published. We have logged a separate ticket ID DIAGRAMJAVA-50598 in our bug tracking system to address the problem of ICML file. We will keep you informed regarding any available updates.

@Zeljko,

The linked ticket ID DIAGRAMJAVA-50598 has been fixed and will be included in the next version 18.4 of Aspose.Diagram for Java API. We will notify you once the next version is published.

The issues you have found earlier (filed as DIAGRAMJAVA-50597,DIAGRAMJAVA-50598) have been fixed in Aspose.Diagram for Java 18.4. This message was posted using BugNotificationTool from Downloads module by imran.rafique