Oh come now. Surely we could think of a worse way. ;)

On Fri, Aug 27, 2010 at 8:20 AM, Rick Root <rick.r...@gmail.com> wrote:

>
> Marc,
>
> This seems like the worst possible way of attempting this.  The POI
> library included with CF8 allows you to manipulate native excel
> documents using java calls from within CF
>
> Check out Ben Nadel's POIUtility.cfc
>
> http://www.bennadel.com/projects/poi-utility.htm
>
> Rick
>
>
> On Thu, Aug 26, 2010 at 4:56 PM, marc -- <m...@marcbakker.com> wrote:
> >
> > Hi,
> >
> > recently I wanted to stream an Excel file from the server to a client
> browser. Before streaming it to the user, I wanted to replace some
> placeholders in the file (like <name>,<place>) with their actual values (#
> user.name#,#user.place#). So this was the setup:
> >
> > 1 read binary (.xls) template file
> > 2 read binary data and replace every occurence of the placeholder with
> it's actual value
> > 3 stream the binary data to the client using <cfcontent variable=...>
> >
> > This cannot be done without converting the binary Excel data to a text
> format.
> >
> > So I tried BinaryEncode(binaryData,"Hex").
> > This gave me the binary data in Hexadecimal format.
> > Then I translated the placeholder (e.g. "<name>") to it's hex
> representation.
> > Then  translated the actual value (e.g. "marc") to it's hex
> representation.
> > Then I did a ReplaceNoCase(a,b,c) where
> > a=the binarydata in HEX format,
> > b=the place holder in hex format,
> > c=the actual value in hex format
> > Then I translated a back to binary using ToBinary()
> >
> > This didn't work since, as I found out, the hexadecimal value for the
> place holder was never found in the converted binary data (in
> ReplaceNoCase(a,b,c) ).
> >
> > Why is this approach not working?
> >
> > Is it possible at all to find and replace text values in an excel file
> this way - so without using things like POI utility?
> >
> > Btw Translating the file to xml is not an option since it contains
> graphics which are not supported in this format.
> >
> > I do this in CF 8 on WinXP
> >
> > Thanks,
> >
> > Marc
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336615
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to