概要
cscの作法、調べてみた。
練習問題、やってみた。
練習問題
closedxmlでasciiなxlsxを作れ。
写真
サンプルコード
using System;
using System.IO;
using ClosedXML.Excel;
namespace App
{
class Program {
static void Main(string[] args) {
var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Book7.xlsx");
var wb = new XLWorkbook();
var ws = wb.Worksheets.Add("Sheet1");
int i;
int j;
byte b = 31;
for (i = 0; i < 16; i++)
{
ws.Cell(1, i + 2).Value = i.ToString();
ws.Cell(1, i + 2).Style.Fill.BackgroundColor = XLColor.Aqua;
}
for (i = 0; i < 6; i++)
{
ws.Cell(i + 2, 1).Value = (i * 16 + 32).ToString();
ws.Cell(i + 2, 1).Style.Fill.BackgroundColor = XLColor.Aqua;
}
for (i = 0; i < 6; i++)
{
for (j = 0; j < 16; j++)
{
b++;
char c2 = Convert.ToChar(b);
ws.Cell(i + 2, j + 2).Value = c2;
}
}
wb.SaveAs(filePath);
Console.WriteLine("ok");
}
}
}
以上。