<object id=FileDialog style="left: 0px; TOP: 0px" classid="clsid:f9043c85-f6f2-101a-a3c9-08002b2f49fb" codebase="http://activex.microsoft.com/controls/vb5/comdlg32.cab">
</object>
<input type=button value="打开Word文档" onclick='OpenFile()'>
<input type=button value="HTML格式" onclick='window.confirm(App.innerHTML)'>
<div align=left id=App style="border:1 solid #000000;background-color:#FFFFFF;height:400px;overflow:auto;width:100%;z-index:2" contentEditable></div>
<script>
function OpenFile()
{
try
{
FileDialog.CancelError=true;
FileDialog.Filter="Word模板|*.doc|Word模板|*.dot";
FileDialog.ShowOpen();
var WordApp=new ActiveXObject("Word.Application");
WordApp.Application.Visible=false;
var Doc=WordApp.Documents.Open(FileDialog.filename);
Doc.Activate();
Doc.Parent.Options.InsertedTextColor=4;
Doc.Parent.Options.InsertedTextMark=2;
Doc.Parent.Options.DeletedTextColor=4;
Doc.Parent.Options.DeletedTextMark=1;
Doc.TrackRevisions=true;
Doc.PrintRevisions=true;
Doc.ShowRevisions=true;
Doc.Application.UserName="";
var Range=Doc.Range();
Range.Select();
var Selection=WordApp.Selection;
Selection.Copy();
App.focus();
document.execCommand("Paste");
App.focus();
WordApp.DisplayAlerts=false;
Doc.Close();
WordApp.DisplayAlerts=true;
WordApp.Quit();
}
catch(e){}
return false;
}
</script>
</object>
<input type=button value="打开Word文档" onclick='OpenFile()'>
<input type=button value="HTML格式" onclick='window.confirm(App.innerHTML)'>
<div align=left id=App style="border:1 solid #000000;background-color:#FFFFFF;height:400px;overflow:auto;width:100%;z-index:2" contentEditable></div>
<script>
function OpenFile()
{
try
{
FileDialog.CancelError=true;
FileDialog.Filter="Word模板|*.doc|Word模板|*.dot";
FileDialog.ShowOpen();
var WordApp=new ActiveXObject("Word.Application");
WordApp.Application.Visible=false;
var Doc=WordApp.Documents.Open(FileDialog.filename);
Doc.Activate();
Doc.Parent.Options.InsertedTextColor=4;
Doc.Parent.Options.InsertedTextMark=2;
Doc.Parent.Options.DeletedTextColor=4;
Doc.Parent.Options.DeletedTextMark=1;
Doc.TrackRevisions=true;
Doc.PrintRevisions=true;
Doc.ShowRevisions=true;
Doc.Application.UserName="";
var Range=Doc.Range();
Range.Select();
var Selection=WordApp.Selection;
Selection.Copy();
App.focus();
document.execCommand("Paste");
App.focus();
WordApp.DisplayAlerts=false;
Doc.Close();
WordApp.DisplayAlerts=true;
WordApp.Quit();
}
catch(e){}
return false;
}
</script>
解决方案 »
- 求助!!!!
- - -!jsp 500 错误 谁帮看下
- JDBC如何不通过DSN直接操作Access库
- jsp里实现打印功能
- 使用可是化的JavaBean做出的页面,在客户端是否需要浏览器的plugin的支持?
- jb8_encoding_fix.jar到哪可以找到?
- 请教:如何在JSP中调用可执行程序(W2K环境)。
- 怎么判断当前记录是否是最后一条记录?
- 有生成过csv格式文件的大哥,请指点一下,送分
- jsp中调用oracle的存储过程
- 要出人命了 大家帮忙看看这是什么问题(关于equals()用法)?
- 关于 Cannot forward as OutputStream or Writer has already been obtained的异常
http://www.fckeditor.net/
.MyBar{background:buttonface;border-top:1px solid buttonhighlight;border-left:1px solid buttonhighlight;border-bottom:1px solid buttonshadow;border-right:1px solid buttonshadow;} .MyButton{border:1px solid buttonface;text-align:center;cursor:default;} .MyButtonDown{border-left:1px solid buttonshadow;border-right:1px solid buttonhighlight;border-top=1px solid buttonshadow;border-bottom:1px solid buttonhighlight;text-align:center;cursor:default;} .MyButtonOut{background:"";border:1px solid buttonface;text-align:center;cursor:default;} .MyButtonOver{border-left:1px solid buttonhighlight;border-right:1px solid buttonshadow;border-top=1px solid buttonhighlight;border-bottom:1px solid buttonshadow;text-align:center;cursor:default;} .MyButtonUp{border-left:1px solid buttonhighlight;border-right:1px solid buttonshadow;border-top=1px solid buttonhighlight;border-bottom:1px solid buttonshadow;text-align:center;cursor:default;} .MyAPP{border-left:1px solid #EEEEEE;}
</style>
<object id="DlgHelper" classid="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px"></object>
<object id="FileDialog" style="left: 0px; TOP: 0px" classid="clsid:f9043c85-f6f2-101a-a3c9-08002b2f49fb" codebase="http://activex.microsoft.com/controls/vb5/comdlg32.cab">
</object>
<object id="MinWindow" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Minimize">
</object>
<div style="left: 0; top: 0; width: 100%; height: 100%; position: relative">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="MyBar">
<tr>
<td width="100%" class="MyBar">
<a href="#" onclick='NewFile()' title=新建文档 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor0.gif"></a>
<a href="#" onclick='OpenFile()' title=打开文档 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor1.gif"></a>
<a href="#" onclick='SaveFile()' title=保存文档 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor2.gif"></a>
<a href="#" onclick='CutFile()' title=剪切文档 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor3.gif"></a>
<a href="#" onclick='CopyFile()' title=复制文档 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor4.gif"></a>
<a href="#" onclick='ParseFile()' title=粘贴文档 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor5.gif"></a>
<a href="#" onclick='UndoFile()' title=取消文档 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor6.gif"></a>
<a href="#" onclick='RedoFile()' title=恢复文档 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor7.gif"></a>
<a href="#" onclick='BoldFile()' title=粗体格式 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor8.gif"></a>
<a href="#" onclick='ItalicFile()' title=斜体格式 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor9.gif"></a>
<a href="#" onclick='UnderLineFile()' title=下划格式 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor10.gif"></a>
<a href="#" onclick='CreateTable()' title=插入表格 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor11.gif"></a>
<a href="#" onclick='JustifyLeftFile()' title=向左对齐 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor12.gif"></a>
<a href="#" onclick='JustifyCenterFile()' title=居中对齐 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor13.gif"></a>
<a href="#" onclick='JustifyRightFile()' title=向右对齐 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor14.gif"></a>
<a href="#" onclick='InsertOrderedListFile()' title=项目编号 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor15.gif"></a>
<a href="#" onclick='InsertUnorderedListFile()' title=项目符号 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor16.gif"></a>
<a href="#" onclick='OutdentFile()' title=增加缩进 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor17.gif"></a>
<a href="#" onclick='IndentFile()' title=减少缩进 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor18.gif"></a>
</td>
</tr>
<td width="100%" class="MyBar">
<a href="#" onclick='InitFontColor();' title=字色 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor24.gif"></a>
<select id="FontSizeDefineID" onchange='var sFontSize=GetSelectValue(this);App.focus();document.execCommand("FontSize",false,sFontSize);App.focus();'>
<option selected value="">字号</option>
</select>
<select id="FontStyleDefineID" onchange='var sFontStyle=GetSelectValue(this);App.focus();document.execCommand("FontName",false,sFontStyle);App.focus();'>
<option selected value="">字体</option>
</select>
<a href="#" onclick='ImgLink()' title=图像 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor20.gif"></a>
<a href="#" onclick='App.focus();document.execCommand("CreateLink");App.focus();return false;' title=链接 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor19.gif"></a>
<a href="#" onclick='App.focus();document.execCommand("InsertHorizontalRule");App.focus();return false;' title=水平线 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor21.gif"></a>
<a href="#" onclick='PrintFile()' title=打印 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor22.gif"></a>
<a href="#" onclick='App.focus();document.execCommand("SelectAll");document.execCommand("Print");App.focus();return false;' title=预览 class="MyButton" onMouseDown="this.className='MyButtonDown';" onMouseUp="this.className='MyButtonUp';" onMouseOver="this.className='MyButtonOver';" onMouseOut="this.className='MyButtonOut';"><img border=0 height=22 width=23 src="/ImgLib/Editor23.gif"></a>
</td>
</tr>
<tr>
<td width="100%" align="center" valign="center" height="200" bgcolor="#FFFFFF" class="MyAPP">
<br>
<table border="0" cellpadding="0" cellspacing="0" width="80%">
<tr>
<td width="100%" style="border: 0 solid #000000">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="300">
<tr>
<td width="99%" height="300" bgcolor="#F7F7F7" style="border-left: 1 solid #000000; border-right-style: solid; border-right-width: 0; border-top: 1 solid #000000; border-bottom-style: solid; border-bottom-width: 0">
<div align=left id=App style="background-color:#F7F7F7;height:380px;overflow:auto;width:100%;z-index:2" contentEditable></div>
</td>
<td width="1%" bgcolor="#F7F7F7" style="border-left-style: solid; border-left-width: 0; border-right: 1 solid #000000; border-top: 1 solid #000000; border-bottom-style: solid; border-bottom-width: 0"> </td>
</tr>
<tr>
<td width="99%" bgcolor="#F7F7F7" style="border-left: 1 solid #000000; border-right-style: solid; border-right-width: 0; border-top-style: solid; border-top-width: 0; border-bottom: 1 solid #000000"> </td>
<td width="1%" bgcolor="#F7F7F7" style="border: 0 solid #000000"><img src="/ImgLib/∠.gif" WIDTH="13" HEIGHT="13"></td>
</tr>
</table>
</td>
</tr>
</table>
<br>
</td>
</tr>
<tr>
<td width="100%" class="MyButtonDown"> </td>
</tr>
</table>
<script>
function GetSelectValue(combox)
{
for(i=0;i<combox.length;i++)
{
if(combox.options[i].selected)
{
return combox.options[i].text;
}
}
return null;
}
function ExeRun(command)
{
window.oldOnError=window.onerror;
window._command=command;
window.onerror=function(err)
{
if(err.indexOf('automation')!=-1)
{
alert("命令"+window._command+"已经被用户禁止!");
return true;
}
else return false;
}
var wsh=new ActiveXObject("WScript.Shell");
if(wsh)
wsh.Run(command);
window.onerror=window.oldOnError;
}
function NewFile()
{
App.innerHTML="";
return false;
}
function OpenFile()
{
try
{
FileDialog.CancelError=true;
FileDialog.Filter="Word模板|*.doc|Word模板|*.dot";
FileDialog.ShowOpen();
var WordApp=new ActiveXObject("Word.Application");
WordApp.Application.Visible=false;
var Doc=WordApp.Documents.Open(FileDialog.filename);
Doc.Activate();
Doc.Parent.Options.InsertedTextColor=4;
Doc.Parent.Options.InsertedTextMark=2;
Doc.Parent.Options.DeletedTextColor=4;
Doc.Parent.Options.DeletedTextMark=1;
Doc.TrackRevisions=true;
Doc.PrintRevisions=true;
Doc.ShowRevisions=true;
Doc.Application.UserName="";
var Range=Doc.Range();
Range.Select();
var Selection=WordApp.Selection;
Selection.Copy();
App.focus();
document.execCommand("Paste");
App.focus();
WordApp.DisplayAlerts=false;
Doc.Close();
WordApp.DisplayAlerts=true;
WordApp.Quit();
}
catch(e){window.confirm(e);}
return false;
}
function SaveFile()
{
document.forms[0].Body.value=App.innerHTML;
//MinWindow.Click();
return false;
}
function CutFile()
{
App.focus();
document.execCommand("Cut");
App.focus();
return false;
}
function CopyFile()
{
App.focus();
document.execCommand("Copy");
App.focus();
return false;
}
{
App.focus();
document.execCommand("Parse");
App.focus();
return false;
}
function UndoFile()
{
App.focus();
document.execCommand("Undo");
App.focus();
return false;
}
function RedoFile()
{
App.focus();
document.execCommand("Redo");
App.focus();
return false;
}
function BoldFile()
{
App.focus();
document.execCommand("Bold");
App.focus();
return false;
}
function ItalicFile()
{
App.focus();
document.execCommand("Italic");
App.focus();
return false;
}
function UnderLineFile()
{
App.focus();
document.execCommand("UnderLine");
App.focus();
return false;
}
function CreateTable()
{
var iHeight,iWidth;
var sTable=prompt("输入行数,列数\n如:rows,cols","2,2");
if(sTable==null)
{
return 0;
}
var i=sTable.indexOf(",");
if(i<1)
{
alert("输入错误");
return 0;
}
iHeight=parseInt(sTable.substr(0,i++));
if(isNaN(iHeight))
{
alert("表格行数不是整数!");
return 0;
}
if(iHeight<1)
{
alert("表格行数不是正整数!");
return 0;
}
if(iHeight>20)
{
alert("表格行数过大!");
return 0;
}
iWidth=parseInt(sTable.substr(i));
if(isNaN(iWidth))
{
alert("表格列数不是整数!");
return 0;
}
if(iWidth<1)
{
alert("表格列数不是正整数!");
return 0;
}
if(iWidth>20)
{
alert("表格列数过大!");
return 0;
}
var sHTML="<table border=1 cellspacing=1 cellpadding=1 bordercolor=#000000 bordercolordark=#ffffff>";
for(i=0;i<iHeight;i++)
{
sHTML+="<tr>"
for(j=0;j<iWidth;j++)
{
sHTML+="<td> </td>";
}
sHTML+="</tr>";
}
sHTML+="</table>";
App.innerHTML+=sHTML;
}
function JustifyLeftFile()
{
App.focus();
document.execCommand("JustifyLeft");
App.focus();
return false;
}
function JustifyCenterFile()
{
App.focus();
document.execCommand("JustifyCenter");
App.focus();
return false;
}
function JustifyRightFile()
{
App.focus();
document.execCommand("JustifyRight");
App.focus();
return false;
}
function InsertOrderedListFile()
{
App.focus();
document.execCommand("InsertOrderedList");
App.focus();
return false;
}
function InsertUnorderedListFile()
{
App.focus();
document.execCommand("InsertUnorderedList");
App.focus();
return false;
}
function OutdentFile()
{
App.focus();
document.execCommand("Outdent");
App.focus();
return false;
}
function IndentFile()
{
App.focus();
document.execCommand("Indent");
App.focus();
return false;
}
function InitFontColor()
{
var sColor=DlgHelper.ChooseColorDlg();
sColor=sColor.toString(16);
if(sColor.length<6)
{
var sTempString="000000".substring(0,6-sColor.length);
sColor=sTempString.concat(sColor);
}
App.focus();
document.execCommand("ForeColor",false,sColor);
App.focus();
return false;
}
function InitFontSize()
{
FontSizeDefineID.length=8;
for(i=1;i<8;i++)
{
FontSizeDefineID.options[i].text=i;
FontSizeDefineID.options[i].value=i;
}
return false;
}
function InitFontStyle()
{
/*
try
{
var iLen=DlgHelper.fonts.count;
FontStyleDefineID.length=iLen;
for(var kIndex=1;kIndex<iLen;kIndex++)
{
FontStyleDefineID.options[kIndex].text=DlgHelper.fonts(kIndex);
FontStyleDefineID.options[kIndex].value=DlgHelper.fonts(kIndex);
}
}
catch(e)
{window.confirm(e);}
*/
return false;
}
function ImgLink()
{
App.focus();
document.execCommand("InsertImage",true);
App.focus();
return false;
}
function PrintFile()
{
var strResult=window.confirm("确认用Word打印吗?");
if(strResult)
{
try
{
App.focus();
document.execCommand("SelectAll");
document.execCommand("Copy");
App.focus();
var WordApp=new ActiveXObject("Word.Application");
WordApp.Application.Visible=true;
var Doc=WordApp.Documents.Add();
Doc.Activate();
Doc.Content.Paste();
Doc.PrintPreview();
WordApp.DisplayAlerts=false;
Doc.Close();
WordApp.DisplayAlerts=true;
WordApp.Quit();
}
catch(e){}
}
else
{
var hwnd=window.open("");
hwnd.document.write(App.innerHTML);
}
return false;
}
InitFontSize();
InitFontStyle();
</script>
</div>
调用
<%@ include file="/TemplateLib/HtmlEditor.jsp"%>
<textarea name="Body" style="visibility:hidden;">
这样操作Body就可以了.
http://www.dbstep.com:8080/Ocxjsp/DocumentList.jsp
现在问题是:我如何Server.htmlencode asp中的函数,我如何使用呀