excl 到表工具

2021-10-23 12:52:14 字數 4056 閱讀 2715

邏輯

using system;

using system.collections.generic;

using system.componentmodel;

using system.data;

using system.drawing;

using system.linq;

using system.text;

using system.threading.tasks;

using system.windows.forms;

using system.io;

using npoi;

using npoi.xssf.usermodel;

using npoi.ss.usermodel;

using npoi.hssf.usermodel;

using npoi.hssf.util;

using npoi.ss.util;

using npoi.poifs.filesystem;

private void button1_click(object sender, eventargs e)

private void label2_click(object sender, eventargs e)

#region

void create()

using (filestream fs = file.openwrite("f:\\excel_project\\pratice1.xlsx"))

console.writeline("ok");

console.readkey();

}void write()

string address = "f:\\excel_project\\pratice1.xlsx"; //指明路徑 

using (filestream fs = file.openwrite(address))

xssfworkbook wk2 = null;

using (filestream fs = file.open(address, filemode.open, fileaccess.read, fileshare.readwrite))

using (filestream filestream = file.open(address, filemode.openorcreate, fileaccess.readwrite))

console.writeline("ok");

console.readkey();

}#region npoi

dictionarycelldata = new dictionary();

void test()

/// /// 向已存在的excel追加資料

///

/// 已存在的excel路徑

/// 追加行索引

/// 追加列索引《列索引,單元格值》

public void addexceldata2(string excelpath, dictionarycelldata)

//獲取工作表

if (workbook.numberofsheets <= 0)

isheet sheet = workbook.getsheetat(0);

int rowindex = sheet.lastrownum;

int tempid = int.parse(sheet.getrow(rowindex).getcell(0).tostring());

string str = "表命:" + sheet.sheetname

+ "\n" + "最大行數: " + sheet.lastrownum

+ "\n" + "最大列數: " + sheet.getrow(0).lastcellnum

+ "\n" + "上一行的id: " + tempid

+ "\n" + "上一行的注釋: " + sheet.getrow(rowindex).getcell(1).tostring()

+ "\n" + "上一行的中文: " + sheet.getrow(rowindex).getcell(2).tostring();

tempid++;

rowindex++;

string str2 = "\n" + "新的id: " + tempid

+ "\n" + "新的注釋: " + celldata[1]

+ "\n" + "新的中文: " + celldata[2];

richtextbox1.text = str+ str2;

獲取行irow row = sheet.getrow(rowindex);

if (row == null)

foreach (keyvaluepairkeyvalue in celldata)

if (keyvalue.key == 0)

else

//設定居中

style = workbook.createcellstyle();

style.verticalalignment = verticalalignment.center;

style.alignment = npoi.ss.usermodel.horizontalalignment.center;

cell.cellstyle = style;

}//using (filestream fs = file.openwrite("f:\\excel_project\\stringconfig1.xlsx"))

//using (filestream filestream = file.open(excelpath, filemode.open, fileaccess.readwrite))

}//for (int r = 0; r < 10; r++)

// }

//}#endregion

private void listbox1_selectedindexchanged(object sender, eventargs e)

private void form1_load(object sender, eventargs e)

private void button2_click(object sender, eventargs e)}}

#endregion

}

介面

using system;

using system.windows.forms;

base.dispose(disposing);

}#region windows 窗體設計器生成的**

/// /// 設計器支援所需的方法 - 不要修改

/// 使用**編輯器修改此方法的內容。

///

private void initializecomponent()

private void label1_click(object sender, eventargs e)

private void textbox1_textchanged(object sender, eventargs e)

#endregion

private system.windows.forms.button button1;

private system.windows.forms.textbox textbox1;

private system.windows.forms.label label1;

private system.windows.forms.richtextbox richtextbox1;

private system.windows.forms.textbox textbox2;

private system.windows.forms.textbox textbox3;

private system.windows.forms.label label2;

private system.windows.forms.label label3;

private button button2;

}}

SAP BO 報表工具

隨著大資料時代的來臨,bi分析工具也熱火朝天的發展起來。由於一直在做sap的bi產品,所以主要圍繞著sap bo提供的報表工具做乙個簡單的選型介紹。目前sap bo提供了下列元件供我們選擇 crystal report 固定格式報表,財務三大表的優秀載體,但是不支援即席查詢。web intellig...

Lua導表工具

寫了個小工具練手,主要功能是把excel表轉化為程式使用表。可以從xml轉換為lua,json,txt,三種方式。這樣的工具即方便了策劃也方便了程式。先說一下感想吧,最開始寫的時候沒想到有加這麼多功能,最開始的僅僅是處理單張表,三行自定義表頭。後面陸續加功能導致 不太好看,也不好維護,不過還好是乙個...

商務智慧型報表工具

商務智慧型 bi 解決方案 artm report 是乙個b s 方式的基於 olap 的多維資料集展現工具。能夠提供給使用者乙個靈活的報表定義和資料分析平台,為使用者提供豐富的資料展現形式和強大的資料分析功能。artm report 能夠讓使用者在客戶端輕鬆地訪問 分析 sql server an...