Re: Anyone with jExcel experience?

2007-06-08 Thread Will Tomlinson
Have you seen Ben Nadel's POI Utility? It's pretty awesome, makes CF/excel 
almost effortless. 

http://www.bennadel.com/index.cfm?dax=blog:474.view

Will


~|
ColdFusion MX7 by Adobe®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. 
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280516
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Anyone with jExcel experience?

2007-06-08 Thread Matt Williams
Okay. I got it working. Definitely some java strictness going on. And
being pretty much java stupid, I did much trial and error to get this
to work. I'll post code here and maybe blog it later so hopefully
anyone in the future can find it. Using jExcel, I was able to open an
existing spreadsheet, make a copy, put in an image an save the new
file.






















 











-- 
Matt Williams
"It's the question that drives us."

~|
CF 8 – Scorpio beta now available, 
easily build great internet experiences – Try it now on Labs
http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280484
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Anyone with jExcel experience?

2007-06-08 Thread Matt Williams
Thanks for replying guys. After playing with both of your code
samples, it turns out my problem was using the word "file" as my
variable name. That is a keyword in java so doing getWorkbook(file)
was breaking.

On to the next step. Has anyone taken an existing image and put it
into a spreadsheet via jExcel? I'm getting a similar error, but this
time on the ImageIO java class. I've checked variable names to make
sure that isn't the problem.

Here is what I have so far (after getting a workbook and a sheet):

img = createObject("java", "java.io.File").init("c:\smallBox.png");
my_input = createObject("java","javax.imageio.ImageIO").read(img);
my_baos = createObject("java","java.io.ByteArrayOutputStream");
ImageIO = createObject("java","javax.imageio.ImageIO");
ImageIO.write(my_input, "png", my_baos);
wi = createObject("java","jxl.write.WritableSheet").init(javaCast('double',1),
javaCast('double',1), javaCast('double',10), javaCast('double',10),
img);
sheet.addImage(wi);



On 6/8/07, Paul Hastings <[EMAIL PROTECTED]> wrote:
> Matt Williams wrote:
> > create a new, blank workbook, so I believe the jar file is installed
> > correctly (placed in c:\CFusionMX7\lib).
>
> stop/restart the cf server service?
>
> > workbook = createObject("java","jxl.Workbook");
> > file = createObject("java","java.io.File").init("C:\invoice.xls");
> > workbook = workbook.getWorkbook(file);
>
> well i normally would do something like:
>
> 
> spreadsheet=createObject("java","java.io.File").init("C:\invoice.xls");
> workBook=createObject("java","jxl.Workbook").getWorkbook(spreadsheet);
> ..
> ..
> ..
> ..
> 
>
> 

~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280479
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Anyone with jExcel experience?

2007-06-08 Thread Paul Hastings
Matt Williams wrote:
> create a new, blank workbook, so I believe the jar file is installed
> correctly (placed in c:\CFusionMX7\lib).

stop/restart the cf server service?

> workbook = createObject("java","jxl.Workbook");
> file = createObject("java","java.io.File").init("C:\invoice.xls");
> workbook = workbook.getWorkbook(file);

well i normally would do something like:


spreadsheet=createObject("java","java.io.File").init("C:\invoice.xls");
workBook=createObject("java","jxl.Workbook").getWorkbook(spreadsheet);
..
..
..
..


~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280477
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Anyone with jExcel experience?

2007-06-08 Thread Dan G. Switzer, II
Matt,

>However, when I call getWorkbook, I get an error saying that method
>cannot be found. Here is what I have that will throw that error.
>
>workbook = createObject("java","jxl.Workbook");
>file = createObject("java","java.io.File").init("C:\invoice.xls");
>workbook = workbook.getWorkbook(file);

Try using this instead:   


// get a handle to the workbook file
file = createObject("java", "java.io.File").init("C:\invoice.xls");

// create the workbook and load the file
workbook = createObject("java","jxl.Workbook");

//get a writeable workbook
writable = createObject("java", "jxl.write.WritableWorkbook");
writable = workbook.getWorkbook(file);

-Dan



~|
ColdFusion MX7 by Adobe®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. 
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280476
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Anyone with jExcel experience?

2007-06-08 Thread Matt Williams
I forgot to add that if anyone has another way to do this, I am open
to that too. I have banged my head up against the Jakarta POI api wall
for a solution to this too. There I am able to open an excel file and
resave it, but the image part doesn't seem to work for me. I get "File
error: data may have been lost" when opening the excel file. I can
post the code I've been using here if it would help anyone.

-- 
Matt Williams
"It's the question that drives us."

~|
ColdFusion MX7 by Adobe®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. 
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280467
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4