使用XDOC云报表非常简单,只需要引入xdoc.js,如下
<script?type="text/javascript"?src="http://xdoc.sinaapp.com/xdoc.js"></script>
下面你就可以把HTML输出为各种文档格式了,示例:
<script?type="text/javascript">
var?html?=?"<html><h1>百度</h1><img?src=\"http://www.baidu.com/img/bdlogo.gif\"></html>";
XDoc.run(html,"pdf");
</script>

?
??????你也可以输出其它格式,文档格式支持flash、pdf、docx、html、rtf、xls、ppt、epub、png图片等,例如:
XDoc.run(html,"docx")

?
????? 你还可以直接指定一个HTML的地址,输出各种文档,HTML可以是asp、jsp、php等服务器端语言生成的,如下:
XDoc.run("http://xdocfile.sinaapp.com/demo/welcome.html","docx");
?

?

?
?完整的示例HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>XDOC Server</title> </head> <body> <script type="text/javascript" src="http://xdoc.sinaapp.com/xdoc.js"></script> <script type="text/javascript"> var html = "<html><h1>百度</h1><img src=\"http://www.baidu.com/img/bdlogo.gif\"></html>"; //XDoc.run(html,"pdf"); //XDoc.run(html,"docx"); XDoc.run("http://xdocfile.sinaapp.com/demo/welcome.html","flash"); </script> </body> </html>?