on 01-26-2006 10:12 AM
Dear All, I have a WebDynpro View which has an IFrame UI Element. This IFrame is getting the html content from a context attribute. In order to show the html formatting properly, I need to use a css file. I am not sure how to create two different types of web resources, 'css' and 'html' and link them together. Following was my starting code, however it does not use the css. Can anybody help?
Best Regars
Manisha
final String formattedStr = html + wdContext.currentContextElement().getRtf();
IWDWebResource cssResource = WDWebResource.getWebResource( wdComponentAPI.getDeployableObjectPart(), WDWebResourceType.CSS, "win_pic.css");
try {
String url = cssResource.getAbsoluteURL();
final IWDCachedWebResource resource = WDWebResource.getPublicCachedWebResource( formattedStr.getBytes("UTF-8"), WDWebResourceType.HTML, WDScopeType.APPLICATION_SCOPE, wdComponentAPI.getDeployableObjectPart(),"win_pic.css" );
resource.setResourceName("HTML_inline.html");
resource.setAttachement(false);
resource.setReadOnce(false);
wdContext.currentContextElement().setURL(resource.getAbsoluteURL());
} catch (WDURLException e) {
// TODO: handle exception
}
catch (final Exception ex){
wdComponentAPI.getMessageManager().reportException(
new WDNonFatalException(ex),
false);
}
Manisha,
Are you composing HTML yourself or you get it from somewhere?
In former case, you may append "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + url + "\" />" to HTML source.
Valery Silaev
EPAM Systems
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Valery, Thanks a lot for your reply. It did help me to understand how to create 2 Web Resources and integrate the css in the html. However the formatting still does not occur. If I preview the source, I see the following (just a short example)
<html><head><link REL="stylesheet" TYPE="text/css" href="http://iwdf70e4:50000/webdynpro/resources/local/ZSalesSummary/Components/com.sap.test.ZSalesSummaryComponent/win_pic.css"/></head><body><table><tr><td>Firma</td></tr><tr><td>Hitech AG</td></tr></table></body></html>
My css file is following:
body
{
background-color:#fffaf0;
}
table {border-style:outset}
So, I expect to see the proper formatting in the IFrame displaying my html (using my css). However I donot see any changes. The output is same as if not using the css.
Can you perhaps locate my error? Thanks again for your help and for your precious time.
Manisha
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.