My question is as follows.
We are using CKEditor to Show the Content of docx file inside Editor. This CKEditor will be loaded in to our Documnentum Application.
I read the word file and converted it into HTML. But when I am trying to set the data of that HTML file using
CKEDITOR.instances.editor1.setData('abc');
it is giving me "abc" as value in screen:
<%
File file = new File("C:\\TestWordToHtml\\html\\Test.html");
BufferedReader br = null;
StringBuilder sb=new StringBuilder();
try {
String sCurrentLine;
br = new BufferedReader(new FileReader(file));
while ((sCurrentLine = br.readLine()) != null) {
sb.append(sCurrentLine);
//System.out.println(sCurrentLine);
}
System.out.println("final content is"+" "+sb.toString());
}
catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (br != null)br.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
String htmdata = sb.toString();`enter code here`
%>
var abc=htmdata;
CKEDITOR.instances.editor1.setData('abc');
Your code is... well - very poor. You have to learn how to pass variable to JS, because in JS htmdata
will be undefined
. Then you need to pass that variable to the setData()
method. Currently you pass there 'abc'
string, not abc
variable.
So the JS part should look like this:
CKEDITOR.instances.editor1.setData(htmdata);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.