cancel
Showing results for 
Search instead for 
Did you mean: 

How to store a file and refer it from another file using the Binary cache?

Former Member
0 Kudos

Hello,

I think it's a long shot but I thought I will give it a try.

I am creating an excel file from an xml String using the Web Dynpro Binary cache.

The problem is that when columns with numbers are involved an extra #agg column is being added by the excel "flattener" which is in charge of rendering the excel file from the xml String.

The only way to override this excel feature is to supply your own XSLT and reference it from the XML. Now, since I am not using an actual filesystem but the Web Dynpro Binary cache, is it possible to use this cache in order to store there the xslt and refer it later from an XML?

Roy

Accepted Solutions (1)

Accepted Solutions (1)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Roy,

what's the exact problem. Like you already store the Excel xml file within the Web Dynpro Binary Cache you can also store an additional xslt file therein. You can calculate the URL for this xslt file and reference it within the xml file. Have you tried this out yet?

Regards, Bertram

Former Member
0 Kudos

Hi Bertram,

Atually I haven't because I thought it would be impossible to reference a file stored in a binary cache from another file. Also, I don't know if giving a URL as a reference instead of an actual file system path would work...

Regards,

Roy

Former Member
0 Kudos

I am in aproccess of trying this now...

I can't see an XSL type that I can store at the binary cache...

Any ideas?

Former Member
0 Kudos

Hello Bertram,

I have just finished implementing this and it doesn't work.

When I open the excel it can't find the location of the xslt file in the binary chache

which is this:

../../local/MappingReportsProject/MappingReportsApp/~wcl key220 1174044701663/parser.xsl

So, I have just tried it and it doesn't work

Former Member
0 Kudos

The reason is this in my opinion: The binary cache is being saved on the server but when you open the excel it is already saved at the client's side so it will always look for the xsl at the client's side which, of course, is not there...

Any ideas?

Former Member
0 Kudos

Have you tried using JExcel APIs ?

<a href="/people/nagamohan.devisetty/blog/2006/08/14/assessment-for-excel-solutions-in-java Creating Excel using Java APIs</a>

Former Member
0 Kudos

Hello Bharathwaj,

I haven't but as far as I've read it acts like POI and I don't want to use these methods because these ones writes the file to the server's filesystem. How the user can get access to this file later, like I do in the binary cache?

Former Member
0 Kudos

Or, I could try putting the xsl file on the server to be accessed by http and try referencing it. Once it's there, any local file will find it... What do you say?

Former Member
0 Kudos

Hi,

WDWebResource.getWebResource(bytes,mime type).getAbsoluteUrl()..

you can get the bytes from server and pass it here..

oops .. havent you been doin this all the while.. reading content from server and getting the url out of it..

and by http , you are sayin thru a webserver.. ? rather complicated for a simple solution Isn't it ?

I would prefer going for the API implementation.. It offers you an amazing array of options to color your cells,change fonts etc.,

Former Member
0 Kudos

I just tried it: Set the xsl on my IIS and refered it from there and it worked, I assume it will work on the App server as well... I am just afraid it is not secured enough.

Bharathwaj: I am using the createWebResource method since getWebResource is deprecated and there I don't have the getAbsoluteUrl method...

Roy

Former Member
0 Kudos

Hey,

WDWebResource.getWebResource(bytes,mime type)

is deprecated, I am using:

WDResourceFactory.createCachedResource(file, name, type);

and there I don't have the getAbsoluteURL method.

Any idea how can I get this absolute URL using the new API?

Roy

Former Member
0 Kudos

Hi,

Just found out this.. See if you can make use of it..

getPublicCachedWebResource(byte[] webResource, WDWebResourceType resourceType, WDScopeType scopeType, WDDeployableObjectPart deployableObjectpart, String key)

<i> returns a IWDCachedWebResource, <b>which is saved directly to the WDDeployableObject directory.</b></i>

you can make WDDeployableObject as your component and point the reference to the component folder.. Since you are specifying a scope type.. it shoukd be deleted after the scope defined...

Lemme know if this works..:)

Former Member
0 Kudos

I think I lost you here...

Can you please pgive me a simple example of this idea?

Former Member
0 Kudos

Wait, I see what you mean and it's also working!

Good one Bharathwaj, problem soved!

Former Member
0 Kudos

Oooops! a problem!

Since it is a Web resource it opens it using the browser's excel plug in and save it this way as well. This means that users cannot save it as a regular excel sheet. Any idea?

Former Member
0 Kudos

My mistake, the Save as... has an xls option...

Answers (0)