RT,写了段JS客户端将网页生成word,其他都能实现,就是不知道如何让他生成时是横向页面,录制宏来作修改也没有成功,请指教
<script language="javascript">
function word()
{
word=new ActiveXObject('word.application');
word.Application.Visible=TRUE;
var doc=word.Document.Add('',0,1);
range=doc.range(0,1);
var sel=Layer1.document.body.createTextRange();
Layer1.document.execCommand('Copy');
sel.moveEnd('character');
range.Paste();
location.reload();
word.ActiveWindow.ActivePane.view.Type=3; //默认为页面视图
}
</script>
<div id=Layer1><input type="button" name="button" value="生成word" onclick="word();"></div>
<script language="javascript">
function word()
{
word=new ActiveXObject('word.application');
word.Application.Visible=TRUE;
var doc=word.Document.Add('',0,1);
range=doc.range(0,1);
var sel=Layer1.document.body.createTextRange();
Layer1.document.execCommand('Copy');
sel.moveEnd('character');
range.Paste();
location.reload();
word.ActiveWindow.ActivePane.view.Type=3; //默认为页面视图
}
</script>
<div id=Layer1><input type="button" name="button" value="生成word" onclick="word();"></div>
ActiveWindow.ActivePane.View.Type=wdPrintView; 换成
word.ActiveWindow.ActivePane.View.Type=wdPrintView; 也不会成功,看来2者属性的值设置不一样的?????
再录制横向页面,宏语法是
With ActiveDocment.PageSetup
.Orientation=wdOrientLandscape
之前直接换成js的话 doc.PageSetup.Orientation=wdOrientLandscape,所以一直不成功结果吧属性值换成1就行了
0应该是纵向页面,1是横向页面,对语法不熟,造成了这个后果.............