public CT_Fill AddNewFill() { CT_Fill fill = new CT_Fill(); this.fillField = fill; return(fill); }
public CT_Fill Copy() { CT_Fill obj = new CT_Fill(); obj.patternFillField = this.patternFillField; return(obj); }
public CT_Fill Copy() { CT_Fill obj = new CT_Fill(); obj.patternFillField = this.patternFillField; obj.gradientFillField = this.gradientFillField; return obj; }
public static CT_Border Parse(string p) { XmlDocument doc = new XmlDocument(); doc.LoadXml(p); return(Parse(doc.DocumentElement, CT_Fill.CreateDefaultNSM())); }
public void TestGetNotModifies() { CT_Fill ctFill = new CT_Fill(); XSSFCellFill cellFill = new XSSFCellFill(ctFill); CT_PatternFill ctPatternFill = ctFill.AddNewPatternFill(); ctPatternFill.patternType = (ST_PatternType.darkDown); Assert.AreEqual(ST_PatternType.darkDown, cellFill.GetPatternType()); }
public void TestGetSetPatternType() { CT_Fill ctFill = new CT_Fill(); XSSFCellFill cellFill = new XSSFCellFill(ctFill); CT_PatternFill ctPatternFill = ctFill.AddNewPatternFill(); ctPatternFill.patternType = (ST_PatternType.solid); Assert.AreEqual(ST_PatternType.solid, cellFill.GetPatternType()); }
public void TestGetFillForegroundColor() { CT_Fill ctFill = new CT_Fill(); XSSFCellFill cellFill = new XSSFCellFill(ctFill); CT_PatternFill ctPatternFill = ctFill.AddNewPatternFill(); CT_Color fgColor = ctPatternFill.AddNewFgColor(); Assert.IsNotNull(cellFill.GetFillForegroundColor()); fgColor.indexed = 8; fgColor.indexedSpecified = true; Assert.AreEqual(8, cellFill.GetFillForegroundColor().Indexed); }
public static CT_Fill Parse(XmlNode node, XmlNamespaceManager namespaceManager) { if (node == null) return null; CT_Fill ctObj = new CT_Fill(); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "patternFill") ctObj.patternFill = CT_PatternFill.Parse(childNode, namespaceManager); else if (childNode.LocalName == "gradientFill") ctObj.gradientFill = CT_GradientFill.Parse(childNode, namespaceManager); } return ctObj; }
public static CT_Fills Parse(XmlNode node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_Fills ctObj = new CT_Fills(); ctObj.count = XmlHelper.ReadUInt(node.Attributes["count"]); ctObj.fill = new List <CT_Fill>(); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "fill") { ctObj.fill.Add(CT_Fill.Parse(childNode, namespaceManager)); } } return(ctObj); }
public void SetUp() { stylesTable = new StylesTable(); ctStylesheet = stylesTable.GetCTStylesheet(); ctBorderA = new CT_Border(); XSSFCellBorder borderA = new XSSFCellBorder(ctBorderA); long borderId = stylesTable.PutBorder(borderA); Assert.AreEqual(1, borderId); XSSFCellBorder borderB = new XSSFCellBorder(); Assert.AreEqual(1, stylesTable.PutBorder(borderB)); ctFill = new CT_Fill(); XSSFCellFill fill = new XSSFCellFill(ctFill); long fillId = stylesTable.PutFill(fill); Assert.AreEqual(2, fillId); ctFont = new CT_Font(); XSSFFont font = new XSSFFont(ctFont); long fontId = stylesTable.PutFont(font); Assert.AreEqual(1, fontId); cellStyleXf = ctStylesheet.AddNewCellStyleXfs().AddNewXf(); cellStyleXf.borderId = 1; cellStyleXf.fillId = 1; cellStyleXf.fontId = 1; cellXfs = ctStylesheet.AddNewCellXfs(); cellXf = cellXfs.AddNewXf(); cellXf.xfId = (1); cellXf.borderId = (1); cellXf.fillId = (1); cellXf.fontId = (1); stylesTable.PutCellStyleXf(cellStyleXf); stylesTable.PutCellXf(cellXf); cellStyle = new XSSFCellStyle(1, 1, stylesTable, null); Assert.IsNotNull(stylesTable.GetFillAt(1).GetCTFill().patternFill); Assert.AreEqual(ST_PatternType.darkGray, stylesTable.GetFillAt(1).GetCTFill().patternFill.patternType); }
public static CT_Dxf Parse(XmlNode node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_Dxf ctObj = new CT_Dxf(); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "font") { ctObj.font = CT_Font.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "numFmt") { ctObj.numFmt = CT_NumFmt.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "fill") { ctObj.fill = CT_Fill.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "alignment") { ctObj.alignment = CT_CellAlignment.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "border") { ctObj.border = CT_Border.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); }
public static CT_Fill Parse(XmlNode node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_Fill ctObj = new CT_Fill(); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "patternFill") { ctObj.patternFill = CT_PatternFill.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "gradientFill") { ctObj.gradientFill = CT_GradientFill.Parse(childNode, namespaceManager); } } return(ctObj); }
/** * Get a <b>copy</b> of the currently used CT_Fill, if none is used, return a new instance. */ private CT_Fill GetCTFill() { CT_Fill ct; if (_cellXf.applyFill) { int FillIndex = (int)_cellXf.fillId; XSSFCellFill cf = _stylesSource.GetFillAt(FillIndex); ct = (CT_Fill)cf.GetCTFill().Copy(); } else { ct = new CT_Fill(); } return ct; }
public void TestGetFillPattern() { Assert.AreEqual(FillPattern.NoFill, cellStyle.FillPattern); int num = stylesTable.GetFills().Count; cellStyle.FillPattern = (FillPattern.SolidForeground); Assert.AreEqual(FillPattern.SolidForeground, cellStyle.FillPattern); Assert.AreEqual(num + 1, stylesTable.GetFills().Count); int FillId = (int)cellStyle.GetCoreXf().fillId; Assert.IsTrue(FillId > 0); //check Changes in the underlying xml bean CT_Fill ctFill = stylesTable.GetFillAt(FillId).GetCTFill(); Assert.AreEqual(ST_PatternType.solid, ctFill.GetPatternFill().patternType); //setting the same fill multiple time does not update the styles table for (int i = 0; i < 3; i++) { cellStyle.FillPattern = (FillPattern.SolidForeground); } Assert.AreEqual(num + 1, stylesTable.GetFills().Count); cellStyle.FillPattern = (FillPattern.NoFill); Assert.AreEqual(FillPattern.NoFill, cellStyle.FillPattern); FillId = (int)cellStyle.GetCoreXf().fillId; ctFill = stylesTable.GetFillAt(FillId).GetCTFill(); Assert.IsFalse(ctFill.GetPatternFill().IsSetPatternType()); }
/** * Get a <b>copy</b> of the currently used CT_Fill, if none is used, return a new instance. */ public CT_Fill GetCTFill() { CT_Fill ct; // bug 56295: handle missing applyFill attribute as "true" because Excel does as well if (!_cellXf.IsSetApplyFill() || _cellXf.applyFill) { int FillIndex = (int)_cellXf.fillId; XSSFCellFill cf = _stylesSource.GetFillAt(FillIndex); ct = (CT_Fill)cf.GetCTFill().Copy(); } else { ct = new CT_Fill(); } return ct; }
private void AddFill(CT_Fill fill) { int idx = _stylesSource.PutFill(new XSSFCellFill(fill)); _cellXf.fillId = (uint)(idx); _cellXf.applyFill = (true); }
/** * Creates an empty CellFill */ public XSSFCellFill() { _fill = new CT_Fill(); }
/** * Creates a CellFill from the supplied parts * * @param fill - fill */ public XSSFCellFill(CT_Fill fill) { _fill = fill; }
public CT_Fill AddNewFill() { CT_Fill fill = new CT_Fill(); this.fillField = fill; return fill; }
private static CT_Fill[] CreateDefaultFills() { CT_Fill[] ctFill = new CT_Fill[] { new CT_Fill(), new CT_Fill() }; ctFill[0].AddNewPatternFill().patternType = (ST_PatternType.none); ctFill[1].AddNewPatternFill().patternType = (ST_PatternType.darkGray); return ctFill; }
public XSSFPatternFormatting(CT_Fill fill) { _fill = fill; }