WMF support in Aspose.Cells


#1

I get a red cross when trying to add a WMF image to a worksheet.
Are WMF images supported for the java version of Aspose.Cells?



Also, I was wondering if images are automatically resized as column widths and row heights are resized.



cheers,

Pierre



#2

Hi Pierre,

Please post your wmf image here.


#3

You’ll have to rename caffeine.jpg to caffeine.wmf (it wouldn’t let me
post a file with a wmf extension). The WMF file was generated
using Piet Jonas’ WMF package for java.



We are evaluating Aspose.Cells to create simple spreadsheets, but our main criteria is;

  • WMF support (because bitmap images are not acceptable to my users).
  • images must expand/shrink as a user changes column/row sizes
  • thread safety (you already mentioned Cells is thread-safe)
  • memory footprint (because some spreadsheets may contain 1000+ WMF images)



    I’m adding the WMF image as follows;



    ByteArrayInputStream imageStream = new ByteArrayInputStream(imageBytes);

    try {

    sheet.getPictures().add(row, col, ++row, ++col, imageStream);

    } finally {

    imageStream.close();

    }



    where imageStream is a streamed version of the WMF image, but all I get is a red cross in Excel.



    thanks for your help.



    cheers,

    Pierre

#4

Hi,

Aspose.Cells for Java supports adding WMF/EMF image.See following codes:

Pictures pictures = sheet.getPictures();
int index = pictures.add(0,0,"F:\\FileTemp\\caffeine.wmf");
Picture p = pictures.get(index);

These codes work fine.


#5

Hi,

2. You could set picture's properties to make images expand/shrink as a user changes column/row sizes.

See following codes: picture.setPlacement(PlacementType.MOVE);

3. Adding images is thread safety.

4 . After adding images ,Aspose.Cells for Java load the content of the images to the memory.So if you have enough memory to contian 1000+ WMF images,Aspose.Cells for Java will work fine too.


#6

Thanks Warren,



It looks like I got it working now. Thank you so much for the
help. I’ll keep banging on this, but it looks like I’ll be buying
a license soon.



cheers,

Pierre