Exemple #1
0
        public CT_MergeCell AddNewMergeCell()
        {
            CT_MergeCell mergecell = new CT_MergeCell();

            mergeCell.Add(mergecell);
            return(mergecell);
        }
 public static CT_MergeCell Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_MergeCell ctObj = new CT_MergeCell();
     ctObj.@ref = XmlHelper.ReadString(node.Attributes["ref"]);
     return ctObj;
 }
Exemple #3
0
        public static CT_MergeCell Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_MergeCell ctObj = new CT_MergeCell();

            ctObj.@ref = XmlHelper.ReadString(node.Attributes["ref"]);
            return(ctObj);
        }
Exemple #4
0
        public static CT_MergeCells Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_MergeCells ctObj = new CT_MergeCells();

            ctObj.count     = XmlHelper.ReadUInt(node.Attributes["count"]);
            ctObj.mergeCell = new List <CT_MergeCell>();
            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "mergeCell")
                {
                    ctObj.mergeCell.Add(CT_MergeCell.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
Exemple #5
0
        /**
         * Removes a merged region of cells (hence letting them free)
         *
         * @param index of the region to unmerge
         */
        public void RemoveMergedRegion(int index)
        {
            CT_MergeCells ctMergeCells = worksheet.mergeCells;

            CT_MergeCell[] mergeCellsArray = new CT_MergeCell[ctMergeCells.sizeOfMergeCellArray() - 1];
            for (int i = 0; i < ctMergeCells.sizeOfMergeCellArray(); i++)
            {
                if (i < index)
                {
                    mergeCellsArray[i] = ctMergeCells.GetMergeCellArray(i);
                }
                else if (i > index)
                {
                    mergeCellsArray[i - 1] = ctMergeCells.GetMergeCellArray(i);
                }
            }
            if (mergeCellsArray.Length > 0)
            {
                ctMergeCells.SetMergeCellArray(mergeCellsArray);
            }
            else
            {
                worksheet.UnsetMergeCells();
            }
        }
Exemple #6
0
        /**
         * Removes a number of merged regions of cells (hence letting them free)
         * 
         * This method can be used to bulk-remove merged regions in a way
         * much faster than calling RemoveMergedRegion() for every single 
         * merged region.
         *
         * @param indices A Set of the regions to unmerge
         */
        public void RemoveMergedRegions(HashSet<int> indices)
        {
            CT_MergeCells ctMergeCells = worksheet.mergeCells;

            int size = ctMergeCells.sizeOfMergeCellArray();
            CT_MergeCell[] mergeCellsArray = new CT_MergeCell[size - indices.Count];
            for (int i = 0, d = 0; i < size; i++)
            {
                if (!indices.Contains(i))
                {
                    mergeCellsArray[d] = ctMergeCells.GetMergeCellArray(i);
                    d++;
                }
            }
            if (mergeCellsArray.Length > 0)
            {
                ctMergeCells.SetMergeCellArray(mergeCellsArray);
            }
            else
            {
                worksheet.UnsetMergeCells();
            }
        }
Exemple #7
0
 public CT_MergeCell AddNewMergeCell()
 {
     CT_MergeCell mergecell = new CT_MergeCell();
     mergeCell.Add(mergecell);
     return mergecell;
 }
Exemple #8
0
 public void SetMergeCellArray(CT_MergeCell[] array)
 {
     mergeCell = new List<CT_MergeCell>(array);
 }