Ejemplo n.º 1
0
        /**
         * Adds a copy of HSSFConditionalFormatting object to the sheet
         * <p>This method could be used to copy HSSFConditionalFormatting object
         * from one sheet to another. For example:
         * <pre>
         * HSSFConditionalFormatting cf = sheet.GetConditionalFormattingAt(index);
         * newSheet.AddConditionalFormatting(cf);
         * </pre>
         *
         * @param cf HSSFConditionalFormatting object
         * @return index of the new Conditional Formatting object
         */
        public int AddConditionalFormatting(IConditionalFormatting cf)
        {
            XSSFConditionalFormatting xcf = (XSSFConditionalFormatting)cf;
            CT_Worksheet sh = _sheet.GetCTWorksheet();

            sh.AddNewConditionalFormatting().Set(xcf.GetCTConditionalFormatting());//this is already copied in Set -> .Copy()); ommitted
            return(sh.SizeOfConditionalFormattingArray() - 1);
        }
        public int AddConditionalFormatting(IConditionalFormatting cf)
        {
            XSSFConditionalFormatting conditionalFormatting = (XSSFConditionalFormatting)cf;
            CT_Worksheet ctWorksheet = this._sheet.GetCTWorksheet();

            ctWorksheet.AddNewConditionalFormatting().Set(conditionalFormatting.GetCTConditionalFormatting());
            return(ctWorksheet.SizeOfConditionalFormattingArray() - 1);
        }