Hello,
I found another issue with some chinese characters. They are showing as junk characters in emf file. Please find attached sheet.xlsx and Generated Emfs.zip.
Note: Things are working fine with windows environment, but not with any Linux environment.
In my font directory, I put extracted calibri.zip (all ttf files).
Sample Code:
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import com.aspose.cells.CellsHelper;
import com.aspose.cells.Workbook;
import com.aspose.slides.License;
public class OLEMigration {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
License l = new License();
l.setLicense(“Aspose.Slides.lic”);
com.aspose.cells.License l1 = new com.aspose.cells.License();
l1.setLicense(“Aspose.Cells.lic”);
Run();
}
public static void Run() throws Exception {
// Create a workbook
CellsHelper.setFontDir("/home/vagrant/Desktop/Fonts");
File file = new File(
“/home/vagrant/Desktop/sheet.xlsx”);
int length = (int) file.length();
FileInputStream fstro = new FileInputStream(file);
byte[] buf = new byte[length];
fstro.read(buf, 0, length);
fstro.close();
Workbook wb = new Workbook(new ByteArrayInputStream(buf));
com.aspose.cells.ImageOrPrintOptions opts = new com.aspose.cells.ImageOrPrintOptions();
opts.setImageFormat(com.aspose.cells.ImageFormat.getEmf());
ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
wb.getWorksheets().get(“Chart”).getCharts().get(0).toImage(imageStream, opts);
FileOutputStream f = new FileOutputStream(new File("/home/vagrant/Desktop/test.emf"));
imageStream.writeTo(f);
f.close();
}
}