/// <summary> /// 加载模板数据 /// </summary> /// <param name="byTmplType"></param> public void LoadTmplData(System.Type byTmplType) { if (byTmplType == null) { // 如果参数对象为空, // 则直接退出! return; } // 获取属性标签 FromXlsxFileAttribute attrObj = ClazzUtil.GetAttribute <FromXlsxFileAttribute>(byTmplType); if (attrObj == null) { // 如果属性标签为空, // 则抛出异常 throw new XlsxTmplError(string.Format( "类 {0} 没有标注 {1} 属性", byTmplType.FullName, typeof(FromXlsxFileAttribute).FullName )); } // 获取文件名、页签索引及起始行索引 string xlsxFileName = attrObj.FileName; string sheetName = attrObj.SheetName; int startFromRowIndex = attrObj.StartFromRowIndex; // 文件绝对路径 string xlsAbsFileName = string.Format( @"{0}\{1}", this.XlsxFileDir, xlsxFileName ); // 获取数据集 DataSet ds = XlsxUtil.GetDS(xlsAbsFileName, sheetName); if (ds == null || ds.Tables.Count <= 0) { // 如果没有数据表, // 则直接退出! return; } // 构建模板对象列表 IList objList = MakeObjList(byTmplType, ds, startFromRowIndex, xlsxFileName); if (objList != null && objList.Count > 0) { this._tmplObjListMap.Add(byTmplType, objList); } }
public void GetNormalizedFormatStringは数値書式文字列を整形して返す() { Assert.AreEqual("0.000", XlsxUtil.GetNormalizedFormatString(".000")); }
public void IsDateFormatは不正なindexが指定されたときfalseを返す() { Assert.IsFalse(XlsxUtil.IsDateFormat(-1, null)); }
public void GetNormalizedFormatStringはnullをわたすと0を返す() { Assert.AreEqual("0", XlsxUtil.GetNormalizedFormatString(null)); }
public void IsDateFormatはtext引数がnullのときfalseを返す() { Assert.IsFalse(XlsxUtil.IsDateFormat(999, null)); }