예제 #1
0
파일: Hello.cs 프로젝트: Ihasa/sandbox
        static void Main()
        {
            try {
                ExBook book = new ExBook("sample.xlsx");

                //シート名からシート取得
                var sheet = book.GetSheet("newSheet");

                //セルに設定
                WriteCell(sheet, 0, 0, "0-0");
                WriteCell(sheet, 1, 1, "1-1");
                WriteCell(sheet, 0, 3, 100);
                WriteCell(sheet, 0, 4, DateTime.Today);

                //日付表示するために書式変更
                var style = book.GetStyle();
                WriteStyle(sheet, 0, 4, style);

                //ブックを保存
                book.SaveBookAs("sample2.xlsx");
            }
            catch (Exception ex) {
                Console.WriteLine(ex);
            }
        }
예제 #2
0
파일: Hello.cs 프로젝트: Ihasa/sandbox
        static void createNewSample()
        {
            string filePath = "sample.xlsx";

            //ブック作成
            var book = ExBook.CreateNew(filePath);

            //シート無しのexcelファイルは保存は出来るが、開くとエラーが発生する
            book.AddSheet("newSheet");

            //ブックを保存
            book.SaveBook();
        }