機房收費系統之將資料匯出到Excel

2021-07-04 02:15:20 字數 931 閱讀 2346

機房中有好多資訊需要匯入到excel**中,需要引用控制項microsoft excel 15.0 object library,可是在工程引用中卻沒有找到,找了好久都沒找到,只好另謀出路。網上搜到的結果是,可以從瀏覽中找到excel.exe的安裝路徑。如下,先將檔案型別選為可執行檔案(.exe;.dll),然後找到excel.exe。預設安裝路徑:c:\program files\microsoft office\office15下的excel.exe。

這樣,此控制項就新增到引用欄裡了。

至於具體的將資料匯出到excel中,

private

sub excel_click() '將資料匯出到excel

dim i as

integer

dim j as

integer

dim xlbook as excel.workbook

dim xlsheet as excel.worksheet

'物件例項化,使其可見

'例項化工作簿和表單

set xlsheet = xlbook.worksheets(1)

'將mshflexgrid中的資料匯入到excel

for i = 0

to myflexgrid.rows - 1

for j = 0

to myflexgrid.cols - 1

myflexgrid.row = i

myflexgrid.col = j

xlsheet.cells(i + 1, j + 1) = trim(myflexgrid.text)

next

next

endsub

這樣就可以將資料匯出到excel中,這只是簡單的能匯出,還需要完善。

機房收費系統 匯出Excel表

前言 機房收費系統進行了很長時間,其中很典型的乙個功能就是匯出excel 很多窗體都需要實現這個功能。主要內容 首先需要在vb的 工程 引用 microsoft excel 15.0object library 然後從vb中的mshflexgrid中匯出資料,實現如下 private sub cmd...

將資料匯出到excel

using system using system.data.oledb using system.io using system.windows.forms namespace postgraduateclient public sqltoexcel string tablename public...

將資料匯出到excel

前台jsp呼叫 function outexe action 將資料匯出到excel action value lpm grpinfoexl public string lpmexl throws exception else if g.getregtime null else rows 當stri...