HI,
I have tried to put html,css and javascript code on doc file, html/ css are working but javascript code not working. I am sending my code,
My problem : I want to send a http to request server when document open, based no response, I will hide/show some content on page.
package asposepoc;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.aspose.words.Document;
import com.aspose.words.DocumentBuilder;
import com.aspose.words.Shape;
import com.aspose.words.ShapeType;
public class AsposeOle {
public static void main(String[] args) {
String docPath = "/home/deepak/1.docx";
try {
Document doc = new Document(docPath);
DocumentBuilder builder = new DocumentBuilder(doc);
DocumentBuilder builder1 = new DocumentBuilder(doc);
builder1.insertHtml("<html><head><script>alert('1');"
+ "var btn = document.createElement('BUTTON');"
+ "btn.innerHTML = 'CLICK ME';"
+ "document.body.appendChild(btn);</script></head>"
+ "<body><div style='color:green'>show div</div><div style='color:green'>hide div</div></body></head>", true);
doc.save("/home/deepak/1_new.docx");
} catch (Exception ex) {
Logger.getLogger(AsposeOle.class.getName()).log(Level.SEVERE, null, ex);
}
}
}