vtdjava的简单介绍

博主:adminadmin 2023-01-25 02:00:16 363

本篇文章给大家谈谈vtdjava,以及对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

如何在.net(c#)里将excel导入到oracle中,如何在.net里读取excel中单元格的数据?

可以运用JAVASRCIRPT,我用这个做的导入导出EXCEL,屡试不爽!参考代码如下:

script type="text/javascript"

function doMenuInPut() {

var ofileupload = document.getElementById("fileUpLoad");

ofileupload.click();

}

function springFrameFunc() {

document.body.style.cursor="wait";

var ofileupload = document.getElementById("fileUpLoad");

var vfilepath = ofileupload.value;

if(vfilepath != "") {

importExcel(vfilepath,"",2);

}

}

function importExcel(filepath,batchGuid,startRowIndex) {

var exApp = new ActiveXObject("Excel.Application");

var exWBook = exApp.workbooks.open(filepath);

var exWSheet = exWBook.Worksheets(1);

var iStartRowIndex = parseInt(startRowIndex);

var i= iStartRowIndex;

var iendRowIndex = iStartRowIndex + 300;

var vTd;

var orow;

var ocell;

var astArray = [];

var astObj;

var totalSign = "1"; // whether all records sign [0: false 1: true]

while (exWSheet.Cells(i, 1).Value != null) {

if(i = iendRowIndex) {

astObj = {};

astObj.assetCode = exWSheet.Cells(i,1).text;

astObj.assetName = exWSheet.Cells(i,2).text;

astObj.assetCounts = exWSheet.Cells(i,17).text;

astObj.assetMoneys = exWSheet.Cells(i,9).text;

astArray.push(astObj);

i += 1;

}

else {

totalSign = "0";

break;

}

}

exWBook.Close (savechanges=true);

exApp.Quit();

exApp = null;

var inputDataObj = {};

inputDataObj.upLoadFile = filepath;

inputDataObj.batchGuid = batchGuid;

inputDataObj.endRowIndex = i.toString();

inputDataObj.totalSign = totalSign;

inputDataObj.astList = astArray;

var jsonExpr = JSON.stringify(inputDataObj,function(key,value){return value;});

PageMethods.SaveInputData(jsonExpr,ClientCallBack);

inputDataObj = null;

}

/script

注意:运行时需要在在IE菜单连的工具中的Internet选型的安全,自定义级别中将ActiveX有关的选项全部启用。

vtdjava的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于、vtdjava的信息别忘了在本站进行查找喔。