Error with form controls or ActiveX controls when saving as EXCEL_97_TO_2003

When I load an EXCEL2010 (xslx) file with form controls or ActiveX controls (and responding macros) inside and save it as EXCEL_97_TO_2003 (xls) then the macros themselves are retained but the assignments to them vanish. Furthermore the controls themselves seem to be exported as drawings (first case) or pictures (OLE case) to XLS instead of the original control types.

Sampel code to reproduce it:

package com.rbinternational.test.aspose;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.junit.BeforeClass;
import org.junit.Test;
import aspose.AsposeLicenceLoader;
import com.aspose.cells.FileFormatType;
import com.aspose.cells.License;
import com.aspose.cells.Workbook;

public class CommandButtonExcelFormatsTest
{
@BeforeClass
public static void licenseAspose()
{
License license = new License();
license.setLicense(AsposeLicenceLoader.getLicenceAsStream());
}

@Test
public void testSaveOLEButtonIntoXLSFormat() throws Exception
{
Workbook workbook = new Workbook(new FileInputStream("xls/AsposeOLEControlTest.xlsm"));
FileOutputStream fos = new FileOutputStream("xls/AsposeOLEControlTest.xls");
workbook.save(fos, FileFormatType.EXCEL_97_TO_2003);
fos.flush();
fos.close();
}

@Test
public void testSaveCommandButtonIntoXLSFormat() throws Exception
{
Workbook workbook = new Workbook(new FileInputStream("xls/AsposeControlTest.xlsm"));
FileOutputStream fos = new FileOutputStream("xls/AsposeControlTest.xls");
workbook.save(fos, FileFormatType.EXCEL_97_TO_2003);
fos.flush();
fos.close();
}
}
package com.rbinternational.test.aspose;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.junit.BeforeClass;
import org.junit.Test;
import aspose.AsposeLicenceLoader;
import com.aspose.cells.FileFormatType;
import com.aspose.cells.License;
import com.aspose.cells.Workbook;

public class CommandButtonExcelFormatsTest
{
@BeforeClass
public static void licenseAspose()
{
License license = new License();
license.setLicense(AsposeLicenceLoader.getLicenceAsStream());
}

@Test
public void testSaveOLEButtonIntoXLSFormat() throws Exception
{
Workbook workbook = new Workbook(new FileInputStream("xls/AsposeOLEControlTest.xlsm"));
FileOutputStream fos = new FileOutputStream("xls/AsposeOLEControlTest.xls");
workbook.save(fos, FileFormatType.EXCEL_97_TO_2003);
fos.flush();
fos.close();
}

@Test
public void testSaveCommandButtonIntoXLSFormat() throws Exception
{
Workbook workbook = new Workbook(new FileInputStream("xls/AsposeControlTest.xlsm"));
FileOutputStream fos = new FileOutputStream("xls/AsposeControlTest.xls");
workbook.save(fos, FileFormatType.EXCEL_97_TO_2003);
fos.flush();
fos.close();
}
}

Does someone know a solution for that?

Regards Manfred

Hi,


I can notice the issue as you have pointed out by using your template template files (XLSM) to save them as XLS file format.

Sample code:

Workbook workbook = new Workbook(new FileInputStream(“xls/AsposeOLEControlTest.xlsm”));
FileOutputStream fos = new FileOutputStream(“xls/AsposeOLEControlTest.xls”);
workbook.save(fos, FileFormatType.EXCEL_97_TO_2003);
fos.flush();
fos.close();


Workbook workbook = new Workbook(new FileInputStream("xls/AsposeControlTest.xlsm"));
FileOutputStream fos = new FileOutputStream("xls/AsposeControlTest.xls");
workbook.save(fos, FileFormatType.EXCEL_97_TO_2003);
fos.flush();
fos.close();

I have logged a ticket with an id: CELLSJAVA-40264. We will look into it to figure it out soon.

Thank you.

Hi,

Thanks for using Aspose.Cells for Java

Please download and try this fix: Aspose.Cells for Java v7.3.0.3

We have fixed the issue of control for one of your template file (AsposeControlTest.xlsm). For another one (AsposeOLEControlTest.xlsm), we need more time to solve it.

@rbi-sw-dev,

We fixed the issue (completely) now. We will share the fix after performing QA and incorporating other enhancements and fixes.

The issues you have found earlier (filed as CELLSJAVA-40264) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi