Kirish Asosoiy qisim


Kod misoli Excel faylini yaratish


Download 0.76 Mb.
bet5/14
Sana28.12.2022
Hajmi0.76 Mb.
#1014407
1   2   3   4   5   6   7   8   9   ...   14
Bog'liq
8888 (Автосохраненный)

Kod misoli
Excel faylini yaratish
using (FastExcel.FastExcel fastExcel = new FastExcel.FastExcel(new FileInfo("Template.xlsx"), new FileInfo("Output.xlsx")))
{ //Create a worksheet with some rows var worksheet = new Worksheet();
var rows = new List();
for (int rowNumber = 1; rowNumber < 100000; rowNumber++)
{ List cells = new List();
for (int columnNumber = 1;
columnNumber < 13; columnNumber++)
{ cells.Add(new Cell(columnNumber, columnNumber *
DateTime.Now.Millisecond)); }
cells.Add(new Cell(13,"FileFormat" + rowNumber));
cells.Add(new Cell(14,"FileFormat Developer Guide"));
rows.Add(new Row(rowNumber, cells)); }
worksheet.Rows = rows; fastExcel.Write(worksheet,"sheet1"); }
Qatorlar va hujayralarni boshqarish
using (FastExcel.FastExcel fastExcel = new FastExcel.FastExcel(new FileInfo("input.xlsx")))
{ //Create a some rows in a worksheet
var worksheet = new Worksheet();
var rows = new List();
for (int rowNumber = 1;
rowNumber < 100000; rowNumber += 50)
{ List cells = new List();
for (int columnNumber = 1;
columnNumber < 13; columnNumber += 2)
{ cells.Add(new Cell(columnNumber, rowNumber)); }
cells.Add(new Cell(13,"File Format Developer Guide"));
rows.Add(new Row(rowNumber, cells)); }
worksheet.Rows = rows; // Read the data fastExcel.Update(worksheet,"sheet1"); }
C# da Excel bilan ishlashning keng qamrovli misollarini tasvirlash.
Boshlash uchun biz COM kutubxonasini quyidagi rasmdagi kabi ulashimiz kerak:

Buni amalga oshirish uchun loyihaga havola qo'shing, bu qanday amalga oshirilganligini bilasiz deb umid qilaman) MAQOMOTI elementini tanlang, Microsoft Excel 16.0 Ob'ektlar kutubxonasini qidiring, katakchani belgilang va OK tugmasini bosing.
Keyinchalik, yozuvni qisqartirish va qulaylik uchun taxallus yaratishimiz kerak.



Download 0.76 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   ...   14




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling