Re: D2W app and Excel and PDF generation example (also msg for David Holt)
Re: D2W app and Excel and PDF generation example (also msg for David Holt)
- Subject: Re: D2W app and Excel and PDF generation example (also msg for David Holt)
- From: Philippe Rabier <email@hidden>
- Date: Fri, 05 Aug 2011 10:38:11 +0200
Hi Johan,
(David, Q for you at then end)
I have the same issue: I want to generate export list into an excel file but I didn't completely succeed because it took too much time to get it work (question of priority).
But I'm not far. So if you are using ModernLook, I found informations: search in the list a msg sent by Markus Ruggiero in march (or look for ERDControllerButton)
What you have to do, is create a controller (see the java class in attachment, small code that exports statistics, only not every list).
I created 2 rules like this one (for each entity and I give you a real code because it's coherent with java class so it's less confusing) :
{
author = 100;
class = "com.webobjects.directtoweb.Rule";
lhs = {
class = "com.webobjects.eocontrol.EOAndQualifier";
qualifiers = (
{
class = "com.webobjects.eocontrol.EOKeyValueQualifier";
key = "entity.name";
selectorName = isEqualTo;
value = NODailyStatistic;
},
{
class = "com.webobjects.eocontrol.EOKeyValueQualifier";
key = task;
selectorName = isEqualTo;
value = list;
}
);
};
rhs = {
class = "er.directtoweb.ERDDelayedObjectCreationAssignment";
keyPath = pageController;
value = "fr.sophiacom.app.ListStatisticsController";
};
}-----------------------------------------
A rule for the file content like this:
{
author = 100;
class = "com.webobjects.directtoweb.Rule";
lhs = {
class = "com.webobjects.eocontrol.EOKeyValueQualifier";
key = pageConfiguration;
selectorName = isEqualTo;
value = ListExcelNODailyStatistic;
};
rhs = {
class = "com.webobjects.directtoweb.Assignment";
keyPath = displayPropertyKeys;
value = (
"application.name",
day,
nbSingleNotification,
nbMassiveNotification,
nbNotification,
nbAppReleaseCreated,
nbAppReleaseRemoved
);
};
}
-----------------------------------------
and one rule to make the controller button working:
{
author = 100;
class = "com.webobjects.directtoweb.Rule";
lhs = {
class = "com.webobjects.eocontrol.EOKeyValueQualifier";
key = propertyKey;
selectorName = isEqualTo;
value = controllerAction;
};
rhs = {
class = "com.webobjects.directtoweb.Assignment";
keyPath = componentName;
value = ERDControllerButton;
};
}
But after that, I didn't see any button in the UI :-(
I found the solution in the wiki, I guess: you have to modify the css (I suppose you have your own css).
By default:
.ERDControllerButton {
display: none;
}
and put something like that (I'm not good at all at css)
/* Beginning ERDControllerButton */
.ERXJSFlyOver span {
left: 45px;
}
.ERXJSFlyOver li {
display: block;
}
.ERDControllerButton {
display: block !important;
}
.ERDControllerButtonLinkList {
display: inline;
margin: 0px;
padding: 0px; /* 0px */
}
.ERDControllerButtonLinkList li {
display: inline;
margin: 10px;
padding: 0px;
font-family: Arial, Geneva, sans-serif;
font-size: 9px;
}
.ERDControllerButtonLinkList li a {
padding: 0px 5px;
}
/* uistyle = "flyOver" */
.ERDControllerButtonFlyOverList {
background-color: #414B5E;
color: #C2C6CF;
border: 1px solid #333;
width: 150px;
padding: 0px;
}
.ERDControllerButtonFlyOverList a {
color: #CCC;
}
.ERDControllerButtonFlyOverList a:hover {
color: #FFF;
text-decoration: underline;
}
/* End ERDControllerButton */
And I was able to see the button (a popup actually) and it WORKS. Very happy. But the button/popup appears on "every" screen (query, edit, …). So I stop my research at this time, because, again, it's not my top priority.
During the WOWODC, I discussed with David (Holt) after his session and he gave me a solution but I wrote on a sheet of paper I lost it :-(
<David>
Can you give us the final step please?
</David>
Hope this helps you a little bit.
Attachment:
ListStatisticsController.java
Description: Binary data
Philippe
---------------------------------------------------------------
SOPHIACOM
http://twitter.com/prabier
On 4 août 2011, at 11:06, Johan Henselmans wrote:
> I want to add PDF and Excel generation to some pages in a D2W application.
>
> I saw some talk about adding Excel or PDF on the mailinglist, but most of it was way over my head, mostly because there seem to be 3 or more ways to achieve the same thing.
>
> I looked if I could find some example in the Wonder Examples and the wiki, but did not find it.
>
> Is there any concise example that someone can share?
>
> (I'd also like to add this feature to ERD2W/CoolComponents, that one could have something like task=list ErPDFDownloadButton=true, if that does not exist already)
>
>
> Johan Henselmans
> email@hidden
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden