0
0

cscの作法 その490

Posted at

概要

cscの作法、調べてみた。
練習問題やってみた。

練習問題

closedxmlで、テンプレートに書き込め。

写真

image.png

サンプルコード


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), "Book3.xlsx");
			var wb = new XLWorkbook("red.xlsx");
			IXLWorksheet sheet1;
			if (wb.TryGetWorksheet("Sheet1", out sheet1))
			{
				Console.WriteLine(sheet1.Name);
			}
			else
			{
				Console.WriteLine("ワークシートを取得できませんでした。");
			}
			sheet1.Cell("b5").Value = "相田株式会社";
			sheet1.Cell("b7").Value = "開発部御中";
			sheet1.Cell("b18").Value = "サーベル";
			sheet1.Cell("e18").Value = "1";
			sheet1.Cell("f18").Value = "本";
			sheet1.Cell("g18").Value = "12500";
			wb.SaveAs(filePath);
			Console.WriteLine("ok");
		}
	}
}



以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0