js怎么识别word张数g

游戏攻略05

js怎么识别word张数g,第1张

js怎么识别word张数g
导读:GetDataFromExcelPagevar idTmr = "";function InertDataFromExcelToDataBase(){var vsFilePath=documentall("InputExcel")value

GetDataFromExcelPage
var idTmr = "";
function InertDataFromExcelToDataBase()
{
var vsFilePath=documentall("InputExcel")value;
if( vsFilePath == undefined || vsFilePath == null || vsFilePath == "undefined"
|| vsFilePath == "" || vsFilePathtoUpperCase()indexOf('XLS') == -1)
{
alert("please choose the excel file !");
return false;
}
//创建Excel程序对象
var vsExcel = "";
try
{
vsExcel = new ActiveXObject("ExcelApplication");
}
catch(err)
{
alert(errdescription);
return false;
}
//打开
var vsBook = vsExcelWorkbooksOpen(vsFilePath);
//Excel的第一张表格
var vsSheet = vsBookWorksheets(1);
vsSheetSelect();
//6行
for(var i=1;i<7;i++)
{
//2列
for(var j=1;j<3;j++)
{
//单元格取值
alert(vsSheetCells(i,j)value);
}
}
/可以如下写法,但是Excel默认的行和列都很大的,好几万呢:)
for(var i=1;i
{
for(var j=1;j
{
alert(vsSheetCells(i,j)value);
}
}
/
vsSheet=null;
vsBook=null;
//退出
vsExcelQuit();
vsExcel = null;
//GarbageCollection
idTmr = windowsetInterval("Cleanup();",1);
return false;
}
function InsertDataFromWordToDataBase()
{
var vsFilePath=documentall("InputWord")value;
if( vsFilePath == undefined || vsFilePath == null
|| vsFilePath == "undefined" || vsFilePath == "" || vsFilePathtoUpperCase()indexOf('DOC') == -1)
{
alert("please choose the word file !");
return false;
}
//创建Word对象
try
{
var vsWordApp = new ActiveXObject("WordApplication");
}
catch(err)
{
alert(errdescription);
return false;
}
//打开Word文档
var wordInfo = vsWordAppDocumentsOpen(vsFilePath);
/ 其他的一些属性
word (index)
Range对象
characters (index)
Range对象
sentences (index)
Range对象
paragraphs (index)
Paragraph对象
sections (index)
Section对象
/
//不可见
vsWordAppVisible = false;
//需要关闭其他word文档,防止出现读取其他文档情况
/
//逐个字符读取整个文档
var characters = vsWordAppdocuments(1)characters
for(var i=1;i
{
alert(characters(i)text);
//alert(vsWordAppApplicationSelection);
//移动一个单元,宽度为1(无论是汉字还是英文字母)
//vsWordAppApplicationSelectionMoveRight(Unit=1,Count=1);
}
//逐个字读取整个文档
var words = vsWordAppdocuments(1)words;
for(var i=1;i<=wordscount;i++)
{
alert(words(i)text);
}
/
//逐个段落读取整个文档
var paragraphs = vsWordAppdocuments(1)paragraphs;
for(var i=1;i<=paragraphscount;i++)
{
alert(paragraphs(i)rangetext);
}
vsWordApp = null;
//关闭
wordInfoClose();
wordInfo = null;
//GarbageCollection
idTmr = windowsetInterval("Cleanup();",1);
return false;
}
function InsertDataFromXMLToDataBase()
{
var vsFilePath=documentall("InputXML")value;
if( vsFilePath == undefined || vsFilePath == null
|| vsFilePath == "undefined" || vsFilePath == "" || vsFilePathtoUpperCase()indexOf('XML') == -1)
{
alert("please choose the xml file !");
return false;
}
var vsXMLApp = "";
//创建XML对象
try
{
vsXMLApp = new ActiveXObject("MicrosoftXMLDOM");
}
catch(err)
{
alert(errdescription);
return false;
}
vsXMLAppasync = true;
vsXMLAppresolveExternals = false;
//打开
vsXMLAppload(vsFilePath)
//取得跟节点下面所有子节点集合
var nodes = vsXMLAppdocumentElementchildNodes;
for( var i = 0; i < nodeslength ; i++ )
{
//对每个子节点取得标记集合
var nodeInfo = nodes[i]getElementsByTagName_r("RecordsetInfo")contextattributes;
for(var j=0;j
{
//每个标记的值
alert(nodeInfo[j]nodeValue);
}
}
//vsXMLAppClose();
vsXMLApp = null;
//GarbageCollection
idTmr = windowsetInterval("Cleanup();",1);
return false;
}
function Cleanup()
{
windowclearInterval(idTmr);
CollectGarbage();
}

以上就是关于js怎么识别word张数g全部的内容,包括:js怎么识别word张数g、、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!