You need to sign in to do that
Don't have an account?
anukarthi_nimmala
Regarding converting rich text editor attribute value to file
Hi,
I have a Rich Text Editor value inmy visualforce page(where rich text editor is a compoonent in my salesforce ).Now i want to pass that value to the controller and convert it to file (.txt/.doc/.csv).I want to convert it to a file type so that i can insert that file to document.body in document object.So please tell me how to convert the component richtext editor value to file type in apex controller.please help me with an example..
my richtext editor component in visualforce page is as below..
<c:RichEditor value="{!document.description}" />
You can use the following code :
In apex :
Employee__c emp = [select id ,testrich__c from employee__c where id='a0C90000000QRGm'];
system.debug('+++++++++++++++'+emp.testrich__c);
document d = new document();
d.name='test';
d.body=blob.valueof(emp.testrich__c);
d.contentType = 'image/text';
d.type= ‘.text’;
d.folderid = UserInfo.getUserId();
insert d;
you can extract the File type(Field: File Extension ) from content type field of document.
Hope this helps.