How to save text as txt file ?
Hi,All.
when I create a string = "this si my country" in webDynpro .
I want save this as a *.txt file . and save this in my computer or open this txt file at once, how to come out this funciton ?
Thanks!
Former Member replied
Hi Doke,
You can simply create a button on click of which you can write the following code and test your application. It will be saved as text file.
String abc = "what ever you want to save to text file save it in the string format";
try
{
IWDCachedWebResource resource = WDWebResource.getWebResource
(
abc.getBytes("UTF-8"), WDWebResourceType.UNKNOWN
);
resource.setResourceName("Doke.txt");
IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(
resource.getUrl(WDFileDownloadBehaviour.ALLOW_SAVE.ordinal()),
resource.getResourceName());
window.show();
}
catch(Exception ex)
{
wdComponentAPI.getMessageManager().reportException( new WDNonFatalException(ex), false );
}
Hope this will help you.
Regards
Sagar Ingalwar