on 03-25-2008 6:00 AM
hai all,
When the user clicks on save button he should be able to save the data in desktop and should be allowed to take print out of the same .Its very urgent plz help me in this issue.
Thanks n Regards
Sharanya.R
You can use FileDownload UIElement in your case,
and the following code under init or action methods
{
// some code
File f = new File("Sample.word");
f.createNewFile();
FileOutputStream fos = new FileOutputStream(f);
byte[] b=wdContext.currentNode().getData().getBytes(); fos.write(b);
fos.write("\t".getBytes());
FileInputStream fis = new FileInputStream(f);
FileChannel fc = fis.getChannel();
byte[] data = new byte[(int)(fc.size())];
ByteBuffer bb = ByteBuffer.wrap(data);
fc.read(bb);
IWDCachedWebResource objCachedWebResource = null;
if (data != null)
{
objCachedWebResource = WDWebResource.getWebResource(data,WDWebResourceType.DOC);
objCachedWebResource.setResourceName(f.getName());
}
wdContext.currentContextElement().setResource(objCachedWebResource.getAbsoluteURL());
//some code
}
Create FileDownload UIElement, Create one Context named Resource, with type String, Map to FileDownload and add above code to some where like init() or any action methods...
regards
rajesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sharanya,
For saving the data in a file, u need to create a file right?? get the data & export that in a doc as explained in excel export sample application (changes r required here bcos in this application xls is used). In the application they r exporting the data to xls & showing that in a popup window, same thing u have to do, only difference is instead of showing that file in a popup window, u have to save it on local system . for that create the file & give the path to save the file using Java IO package.
regards
Sumit
hai,
If iam using Adobe interactive forms
1.Can i get the data from database to be displayed in the form.
2.can one view alone of my application contain this AIF.
3.Can we save this as Word doc.
Then in the excel export when i tried they say it deals with XML which can be done only for excel not for word.Plz suggest me if there is any other option for doing that
Thanks n Regards
Sharanya.R
Hi,
3) It saves as PDF not as word.
1) and 2)
Basically Adobe interactive form is also an UIelement , which can contain subForm just like our view .
And then u can add the elements , input field, table, label,etc as same in the view.
Suppose u are bringing the data from backend into node of a context, we do binding for uielements in the view.
The same we do here. Binding with the node.
So procedure is --> View --> add ui Adobe Interactive Form --> Edit the form by adding controls on it and then binding.
But If already AIF are using in your project , then you can go ...otherwise again configurations settings may kill
your time at present....
Can you say how much data you need ....on the word document ....
Is it one page or it will be multiple pages..........
Thanks ,
Srini
hai Srinivas,
Thanks for the inpt.The data will be only be within a page.In that case An AIF may contain so many ui elements in that case if i bind the data from backend to AIF which UI element in form will carry the data.Plz do suggest me if there any other way to acheive this.
Thanks n Regards
Sharanya.R
Hi,
Forget about AIF , How u thought earlier, In the view , u will bind the backend data for a node of a context.
You will execute the method through JCo connections etc.
say :
Context
|
nodeBackend (node)
\ x (attibute)
y (attribute)
z (attribute)
Then , u will bind these x, y,z to some UIelements in the View. Isn't it .
Similarly ..........
Now come to AIF point,
In the Interactive form .........u take some controls ( these are not UI elements of the view , they are different for AIF form ) ..........add it form adn bind x,y,z .
The nodeBackend , x,y,z are also available to Interactive form , because it is just a control in the View.
Send your email address,,,,,so that i will send one page screen shot of binding...of AIF Form....
Thanks ,
Srini
hai Srinivas,
The requirement is as follows.
1.I have developed a web dynpro appln for customers.
2.when a customer clicks on a product he ll be shown the details(eg-wiring diameter,voltage level) of the product in a text edit which comes from database based on product selected.
3.The customer needs to save the details in the text edit in desktop and if he needs he may take prinout of that details in future.
Plz help me in doing this.
Thanks n Regards
Sharanya.R
Hi,
Can I know .... .. In your project AIF usage is ready ....ADS configuration is ok .
For your NWDS , life cycle designer is installed . If so ... if you have decided to use AIF means ...
And also usage of AIFs are limited , if crossed the number , company will be charged for extra usage of AIF
I will develop small application according to u r output and send you.
Thanks ,
Srini
Hi,
Hold for sometime ( around 1 hour ) .... i will send you sample application...
Then better u can decide ....what to use................
Meanwhile....pls make your trails .........................
See ,Saving on client machine. and Printing is biggest problem .....we too are facing........
I cannot say this is the right option ..but if this suits your requirement ..proceed....
Thanks ,
Srini
Hi,
I have sent you two docs ...Both the options work fine for your needs, Choose the one with which u r comfort.
1) Adobe Interactive Forms. -- SampelAIF
2) KM related . -- SaveFile.
Just briefly I have written points in the starting . All the conversions everything is there in the word document.
Step by Step , no need to convert again ...
String s = new String(wdContext.currentContextElement().getStr()); // str is the TextEdit binded String
byte[] bytes = s.getBytes(); // string converted to bytes
WDWebResourceType.getWebResourceTypeForFileExtension("doc"); // setting to doc for word doc or else
// u can set anything like pdf, xls,etc
// making the contents to create a file in KM
_in = new ByteArrayInputStream(bytes);
IContent cont1 =(IContent) new Content(_in,resourceType1.getHtmlMime() /"image/jpg"/, _in.available());
// creating the file
IResource resource2 = empFolder.createResource(fn, null, cont1); // create the file where fn is the file name
Pls , go through the document....That is tested application ......
Thanks ,
Srini
Hi Sharanya,
In which format ur data has to be saved?? U want to save data in a ms word file or pdf or what.???? In case u want word file, use office control provided by sap.
regards
Sumit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sharanya,
I don't have any running application with me, so can't provide the code. Check these Tutorials, it requires some excercise,
Here u can find the sample application as Excel export.
https://www.sdn.sap.com/irj/sdn/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#58
regards
Sumit
Hi Sharanya,
have u checked the excel export sample application & tutotial?? There data is exported to xls but u can try with .doc file as well.
Check the exportToExcel2003 method in that & make some changes like instead of WDWebResourceType.XLS u can use WDWebResourceType.Doc etc.
I m not very sure abt that but it may work.
regards
Sumit
Edited by: Sumit Malhotra on Mar 25, 2008 12:35 PM
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.