..and I just found this; http://www.softinterface.com/Convert-XLS/Features/Convert-XLSM.htm
which may help. Use HSSF/XSSF to create the file then run it through the converter. There is a free trial and it has a command line interface which should make it far easier to run from Java code. Again though it is a commercial product. --- On Thu, 11/27/08, Anthony Andrews <[EMAIL PROTECTED]> wrote: From: Anthony Andrews <[EMAIL PROTECTED]> Subject: Re: Java API to support xlsm format (office 2007) and create more than 65536 rows To: "POI Users List" <[email protected]> Date: Thursday, November 27, 2008, 8:39 AM The .xslm extension is specific to Excel 2007 - I have seen it referred to as an 'Excel 2007 Macro Enabled Workbook' - so it is unlikely many of the open source options will support it yet. From what I understand, this feature was introduced so that users were no longer faced with the message informing them that the workbook contained macros and asking them whether or not to allow the code to execute. I can almost guarantee (Microsoft!!) that it will not be as simple as re-naming the file from .xls to .xlsm but do not know enough to really express this opinion as fact. There are commercial products that offer to support .xlsm. One I have just found is here; http://www.aspose.com/categories/file-format-components/aspose.cells-for-.net-and-java/default.aspx#Features but this will mean purchasing software assuming the free trail is successful. Sorry I cannot help further. The only APIs I have used in connection with Excel are JExcel and HSSF and neither - to my knowledge - support this file format. I would reckon that your best option - that is free option - may be to use COM to directly manipulate Excel itself, but this does have more than one problem; it is quite slow, you cannot use it in a distributed environment (Excel must be installed on the machine that is running the code) and Excel itself is designed to be used interactively so there is no way to trap and handle errors programmatically. I have used the SWT to 'control' Excel using Java code and understand that the JACOB project provides another successful option. Whilst it is by no means hard, it is neither neat, nor especially efficient. What you may look at is creating the workbook using something like HSSF/XSSF and then use COM to open the workbook and re-save it under the .xlsm extension. Maybe this will be enough to enable the macros. --- On Thu, 11/27/08, navjamsster <[EMAIL PROTECTED]> wrote: From: navjamsster <[EMAIL PROTECTED]> Subject: Re: Java API to support xlsm format (office 2007) and create more than 65536 rows To: [email protected] Date: Thursday, November 27, 2008, 5:17 AM Hello Anthony, Thanks a lot for your quick response and Information. I do not want to create macro through Java API. I have a Macro(eg. macro.xls) file, which I provide as a input to one of my method which is generating an excel report containing more than 65000 rows. Now I am able to create excel report(eg: result.xlsx)with more than 65000 rows , but my macro is not enabled because this file does not have extension ".xlsm". I wanted to know, how to create a file with extension ".xlsm" (macro file) through java api. I have got the following error while trying the below code String file = "timesheet.xls"; if(wb instanceof XSSFWorkbook) file += "m"; http://www.nabble.com/file/p20719133/error.jpg Any sample code is more useful. Anthony Andrews wrote: > > Though there is already support for the xml based file format in HSSF (the > XSSF strand I believe) I think it unlikely that you will find such an API > as most aim for some measure of backward compatibility - the limit to the > number of rows has only recently been overridden if I remember correctly. > As you probably know HSSF does not support the creation or modifcation of > macros yet (though I am sure that any help to modify the application would > be welcomed). > > There are commercial products you might wish to look at and there is a > good list available here; > > http://schmidt.devlib.org/java/libraries-excel.html > > One other route you may want to look at is COM. This does have limitations > but allows you to manipulate the Excel application itself so there is > almost no limit to what you could do. The other option is to look at > OpenOffice; I seem to remember that it is possible to access the libraries > that comprise this application and that may be one route to those features > you seek. > > P.S. HSSF does support macros in that it will preserve them when > opening/copying an existing workbook. Many people choose to create a > template containing those macros they will need and use this as the base > for the creation of a workbook. > > --- On Thu, 11/27/08, navjamsster <[EMAIL PROTECTED]> wrote: > From: navjamsster <[EMAIL PROTECTED]> > Subject: Java API to support xlsm format (office 2007) and create more > than 65536 rows > To: [email protected] > Date: Thursday, November 27, 2008, 3:05 AM > > Is there any JAVA API open source or license product which generate more > than 65536 rows in Excel throug java application? Are they support for > macros(xlsm or xlsx format)? > > > -- > View this message in context: > http://www.nabble.com/Java-API-to-support-xlsm-format-%28office-2007%29-and-create-more-than-65536-rows-tp20717321p20717321.html > Sent from the POI - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- View this message in context: http://www.nabble.com/Java-API-to-support-xlsm-format-%28office-2007%29-and-create-more-than-65536-rows-tp20717321p20719133.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
