當前位置: 首頁>>代碼示例>>C#>>正文


C# Spreadsheet.CT_Xf類代碼示例

本文整理匯總了C#中NPOI.OpenXmlFormats.Spreadsheet.CT_Xf的典型用法代碼示例。如果您正苦於以下問題:C# CT_Xf類的具體用法?C# CT_Xf怎麽用?C# CT_Xf使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CT_Xf類屬於NPOI.OpenXmlFormats.Spreadsheet命名空間,在下文中一共展示了CT_Xf類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Parse

 public static CT_Xf Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_Xf ctObj = new CT_Xf();
     ctObj.numFmtId = XmlHelper.ReadUInt(node.Attributes["numFmtId"]);
     ctObj.fontId = XmlHelper.ReadUInt(node.Attributes["fontId"]);
     ctObj.fillId = XmlHelper.ReadUInt(node.Attributes["fillId"]);
     ctObj.borderId = XmlHelper.ReadUInt(node.Attributes["borderId"]);
     ctObj.xfId = XmlHelper.ReadUInt(node.Attributes["xfId"]);
     ctObj.quotePrefix = XmlHelper.ReadBool(node.Attributes["quotePrefix"]);
     ctObj.pivotButton = XmlHelper.ReadBool(node.Attributes["pivotButton"]);
     ctObj.applyNumberFormat = XmlHelper.ReadBool(node.Attributes["applyNumberFormat"]);
     ctObj.applyFont = XmlHelper.ReadBool(node.Attributes["applyFont"]);
     ctObj.applyFill = XmlHelper.ReadBool(node.Attributes["applyFill"]);
     ctObj.applyBorder = XmlHelper.ReadBool(node.Attributes["applyBorder"]);
     ctObj.applyAlignment = XmlHelper.ReadBool(node.Attributes["applyAlignment"]);
     ctObj.applyProtection = XmlHelper.ReadBool(node.Attributes["applyProtection"]);
     foreach (XmlNode childNode in node.ChildNodes)
     {
         if (childNode.LocalName == "alignment")
             ctObj.alignment = CT_CellAlignment.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "protection")
             ctObj.protection = CT_CellProtection.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "extLst")
             ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
     }
     return ctObj;
 }
開發者ID:Reinakumiko,項目名稱:npoi,代碼行數:29,代碼來源:CT_Xf.cs

示例2: AddNewXf

 public CT_Xf AddNewXf()
 {
     if (this.xfField == null)
         this.xfField = new List<CT_Xf>();
     CT_Xf xf = new CT_Xf();
     this.xfField.Add(xf);
     return xf;
 }
開發者ID:kenlen,項目名稱:npoi,代碼行數:8,代碼來源:CT_CellStyleXfs.cs

示例3: Copy

        public CT_Xf Copy()
        {
            CT_Xf obj = new CT_Xf();
            obj.alignmentField = this.alignmentField;
            obj.protectionField = this.protectionField;
            obj.extLstField = null == extLstField ? null : this.extLstField.Copy();

            obj.applyAlignmentField = this.applyAlignmentField;
            obj.applyBorderField = this.applyBorderField;
            obj.applyFillField = this.applyFillField;
            obj.applyFontField = this.applyFontField;
            obj.applyNumberFormatField = this.applyNumberFormatField;
            obj.applyProtectionField = this.applyProtectionField;
            obj.borderIdField = this.borderIdField;
            obj.fillIdField = this.fillIdField;
            obj.fontIdField = this.fontIdField;
            obj.numFmtIdField = this.numFmtIdField;
            obj.pivotButtonField = this.pivotButtonField;
            obj.quotePrefixField = this.quotePrefixField;
            obj.xfIdField = this.xfIdField;
            return obj;
        }
開發者ID:xiepeixing,項目名稱:npoi,代碼行數:22,代碼來源:Styles.cs

示例4: CreateDefaultXf

 private static CT_Xf CreateDefaultXf()
 {
     CT_Xf ctXf = new CT_Xf();
     ctXf.numFmtId = 0;
     ctXf.fontId = 0;
     ctXf.fillId = 0;
     ctXf.borderId = 0;
     return ctXf;
 }
開發者ID:eatage,項目名稱:npoi,代碼行數:9,代碼來源:StylesTable.cs

示例5: ReplaceCellStyleXfAt

 internal void ReplaceCellStyleXfAt(int idx, CT_Xf cellStyleXf)
 {
     styleXfs[idx] = cellStyleXf;
 }
開發者ID:eatage,項目名稱:npoi,代碼行數:4,代碼來源:StylesTable.cs

示例6: PutCellStyleXf

 internal int PutCellStyleXf(CT_Xf cellStyleXf)
 {
     styleXfs.Add(cellStyleXf);
     return styleXfs.Count;
 }
開發者ID:eatage,項目名稱:npoi,代碼行數:5,代碼來源:StylesTable.cs

示例7: ReplaceCellXfAt

 internal void ReplaceCellXfAt(int idx, CT_Xf cellXf)
 {
     xfs[idx] = cellXf;
 }
開發者ID:eatage,項目名稱:npoi,代碼行數:4,代碼來源:StylesTable.cs

示例8: PutCellXf

 internal int PutCellXf(CT_Xf cellXf)
 {
     xfs.Add(cellXf);
     return xfs.Count;
 }
開發者ID:eatage,項目名稱:npoi,代碼行數:5,代碼來源:StylesTable.cs

示例9: ReplaceCellXfAt

 public void ReplaceCellXfAt(int idx, CT_Xf cellXf)
 {
     xfs[idx] = cellXf;
 }
開發者ID:xoposhiy,項目名稱:npoi,代碼行數:4,代碼來源:StylesTable.cs

示例10: PutCellXf

 public int PutCellXf(CT_Xf cellXf)
 {
     xfs.Add(cellXf);
     return xfs.Count;
 }
開發者ID:xoposhiy,項目名稱:npoi,代碼行數:5,代碼來源:StylesTable.cs

示例11: Save

 public static void Save(Stream stream, CT_Xf font)
 {
     serializer.Serialize(stream, font, namespaces);
 }
開發者ID:xiepeixing,項目名稱:npoi,代碼行數:4,代碼來源:Styles.cs

示例12: CreateCellStyle

 public XSSFCellStyle CreateCellStyle()
 {
     CT_Xf ctXf = new CT_Xf();
     ctXf.numFmtId = 0;
     ctXf.fontId = 0;
     ctXf.fillId = 0;
     ctXf.borderId = 0;
     ctXf.xfId = 0;
     int xfSize = styleXfs.Count;
     int indexXf = PutCellXf(ctXf);
     return new XSSFCellStyle(indexXf - 1, xfSize - 1, this, theme);
 }
開發者ID:eatage,項目名稱:npoi,代碼行數:12,代碼來源:StylesTable.cs

示例13: TestGetSetColDefaultStyle

        public void TestGetSetColDefaultStyle()
        {
            XSSFWorkbook workbook = new XSSFWorkbook();
            XSSFSheet sheet = (XSSFSheet)workbook.CreateSheet();
            CT_Worksheet ctWorksheet = sheet.GetCTWorksheet();
            ColumnHelper columnHelper = sheet.GetColumnHelper();

            // POI column 3, OOXML column 4
            CT_Col col = columnHelper.GetOrCreateColumn1Based(4, false);

            Assert.IsNotNull(col);
            Assert.IsNotNull(columnHelper.GetColumn(3, false));
            columnHelper.SetColDefaultStyle(3, 2);
            Assert.AreEqual(2, columnHelper.GetColDefaultStyle(3));
            Assert.AreEqual(-1, columnHelper.GetColDefaultStyle(4));
            StylesTable stylesTable = workbook.GetStylesSource();
            CT_Xf cellXf = new CT_Xf();
            cellXf.fontId = (0);
            cellXf.fillId = (0);
            cellXf.borderId = (0);
            cellXf.numFmtId = (0);
            cellXf.xfId = (0);
            stylesTable.PutCellXf(cellXf);
            CT_Col col_2 = ctWorksheet.GetColsArray(0).AddNewCol();
            col_2.min = (10);
            col_2.max = (12);
            col_2.style = (1);
            col_2.styleSpecified = true;
            Assert.AreEqual(1, columnHelper.GetColDefaultStyle(11));
            XSSFCellStyle cellStyle = new XSSFCellStyle(0, 0, stylesTable, null);
            columnHelper.SetColDefaultStyle(11, cellStyle);
            Assert.AreEqual(0u, col_2.style);
            Assert.AreEqual(1, columnHelper.GetColDefaultStyle(10));
        }
開發者ID:ctddjyds,項目名稱:npoi,代碼行數:34,代碼來源:TestColumnHelper.cs

示例14: TestSetDefaultColumnStyle

        public void TestSetDefaultColumnStyle()
        {
            XSSFWorkbook workbook = new XSSFWorkbook();
            XSSFSheet sheet = (XSSFSheet)workbook.CreateSheet();
            CT_Worksheet ctWorksheet = sheet.GetCTWorksheet();
            StylesTable stylesTable = workbook.GetStylesSource();
            XSSFFont font = new XSSFFont();
            font.FontName = ("Cambria");
            stylesTable.PutFont(font);
            CT_Xf cellStyleXf = new CT_Xf();
            cellStyleXf.fontId = (1);
            cellStyleXf.fillId= 0;
            cellStyleXf.borderId= 0;
            cellStyleXf.numFmtId= 0;
            stylesTable.PutCellStyleXf(cellStyleXf);
            CT_Xf cellXf = new CT_Xf();
            cellXf.xfId = (1);
            stylesTable.PutCellXf(cellXf);
            XSSFCellStyle cellStyle = new XSSFCellStyle(1, 1, stylesTable, null);
            Assert.AreEqual(1, cellStyle.FontIndex);

            sheet.SetDefaultColumnStyle(3, cellStyle);
            Assert.AreEqual(1u, ctWorksheet.GetColsArray(0).GetColArray(0).style);
        }
開發者ID:WPG,項目名稱:npoi,代碼行數:24,代碼來源:TestXSSFSheet.cs

示例15: CreateCellStyle

 public XSSFCellStyle CreateCellStyle()
 {
     int xfSize = styleXfs.Count;
     if (xfSize > MAXIMUM_STYLE_ID)
         throw new InvalidOperationException("The maximum number of Cell Styles was exceeded. " +
                   "You can define up to " + MAXIMUM_STYLE_ID + " style in a .xlsx Workbook");
 
     CT_Xf ctXf = new CT_Xf();
     ctXf.numFmtId = 0;
     ctXf.fontId = 0;
     ctXf.fillId = 0;
     ctXf.borderId = 0;
     ctXf.xfId = 0;
     
     int indexXf = PutCellXf(ctXf);
     return new XSSFCellStyle(indexXf - 1, xfSize - 1, this, theme);
 }
開發者ID:Reinakumiko,項目名稱:npoi,代碼行數:17,代碼來源:StylesTable.cs


注:本文中的NPOI.OpenXmlFormats.Spreadsheet.CT_Xf類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。