示例#1
0
        /// <summary>
        /// Sndシートのデータ埋めと書式あてこみメソッド
        /// </summary>
        /// <param name="book">ExcelBookオブジェクト</param>
        /// <param name="lists">HULFT配信定義データオブジェクト</param>
        /// <returns></returns>
        public bool UpdateSndBook(IWorkbook book, List <HulftSndDef> lists)
        {
            var sheet = book.GetSheet(ConstHulft.SHEETNAME_SND);

            // セルに充てるスタイルの組み立て
            Dictionary <String, ICellStyle> styles = MyCreateStyles.CreateStyles(book);

            // 左上にシート名を
            WriteCell(sheet, styles["indexLabel"], (0, 0), ConstHulft.SHEETNAME_SND);

            // データヘッダーの組み立て
            var header     = new HulftSndDef("Header");
            var headerList = header.GetListValues();

            // データヘッダーブロックの書き出し
            (int y, int x)p = (2, 1);
            headerList.Insert(0, "No.");
            for (int x = 0; x < headerList.Count; x++)
            {
                WriteCell(sheet, styles["indexLabel"], (p.y, p.x + x), headerList[x]);
            }
            sheet.SetAutoFilter(new CellRangeAddress(p.y, p.y, p.x, p.x + headerList.Count - 1));

            // データブロックの書き出し
            p = (3, 1);
            for (int y = 0; y < lists.Count; y++)
            {
                var dataList = lists[y].GetListValues();
                dataList.Insert(0, (y + 1).ToString());
                for (int x = 0; x < dataList.Count; x++)
                {
                    if (x == 1)
                    {
                        WriteCell(sheet, styles["defDataBa"], (p.y + y, p.x + x), dataList[x]);
                    }
                    else
                    {
                        WriteCell(sheet, styles["defData"], (p.y + y, p.x + x), dataList[x]);
                    }
                }
            }

            // カラムのAutoSize
            for (int x = 0; x < headerList.Count; x++)
            {
                sheet.AutoSizeColumn(p.x + x, true);
            }

            return(true);
        }
示例#2
0
        public static List <HulftSndDef> StringBuildHulftSndDef(string HtmlText)
        {
            string fileContent = "";

            //HULFT配信定義のクラスと積み上げたList型
            List <HulftSndDef> hulftSndDefs = new List <HulftSndDef>();
            //Dictionary<string, HulftSndDef> dict = new Dictionary<string,HulftSndDef>();
            HulftSndDef hulftdef = new HulftSndDef();

            using (StringReader sr = new StringReader(HtmlText))
            {
                while ((fileContent = sr.ReadLine()) != null)
                {
                    //Debug.WriteLine(fileContent);
                    fileContent = fileContent.Trim();
                    if (fileContent == "")
                    {
                        continue;
                    }
                    if (fileContent == "#")
                    {
                        continue;
                    }

                    string[] array = fileContent.Split('=');
                    switch (array[0])
                    {
                    case "# ID":
                        hulftdef.ClearRest();
                        hulftdef.Id = array[1];
                        break;

                    case "SNDFILE":
                        hulftdef.SndFile = array[1];
                        break;

                    case "FILENAME":
                        hulftdef.FileName = array[1];
                        break;

                    case "DBID":
                        hulftdef.DbId = array[1];
                        break;

                    case "TRANSTYPE":
                        hulftdef.TransType = array[1];
                        break;

                    case "TRANSPRTY":
                        hulftdef.Transprty = array[1];
                        break;

                    case "INTERVAL":
                        hulftdef.Interval = array[1];
                        break;

                    case "BLOCKLEN":
                        hulftdef.BlockLen = array[1];
                        break;

                    case "BLOCKCNT":
                        hulftdef.BlockCnt = array[1];
                        break;

                    case "COMP":
                        hulftdef.Comp = array[1];
                        break;

                    case "JOBID":
                        hulftdef.JobId = array[1];
                        break;

                    case "COMMENT":
                        hulftdef.Comment = string.Join("=", array.Skip(1).Take(2));
                        break;

                    case "GRPID":
                        hulftdef.GrpId = array[1];
                        break;

                    case "FMTID":
                        hulftdef.FmtId = array[1];
                        break;

                    case "EJOBID":
                        hulftdef.EjobId = array[1];
                        break;

                    case "KJCHNGE":
                        hulftdef.KjChnge = array[1];
                        break;

                    case "CLEAR":
                        hulftdef.Clear = array[1];
                        break;

                    case "PASSWORD":
                        hulftdef.Password = array[1];
                        break;

                    case "CODESET":
                        hulftdef.CodeSet = array[1];
                        break;

                    case "COMPSIZE":
                        hulftdef.CompSize = array[1];
                        break;

                    case "SHIFTTRANSACT":
                        hulftdef.Shifttransact = array[1];
                        break;

                    case "PREJOBID":
                        hulftdef.PrejobId = array[1];
                        break;

                    case "END":
                        hulftSndDefs.Add(hulftdef.Clone());
                        break;
                    }
                }
            }

            return(hulftSndDefs);
        }