예제 #1
0
        /**
         * Builds new numeric cache Container.
         * @param marker data marker to use for cache Evaluation
         * @param ctNumRef parent number reference
         * @return numeric cache instance
         */
        internal static XSSFNumberCache BuildCache(DataMarker marker, CT_NumRef ctNumRef)
        {
            CellRangeAddress range = marker.Range;
            int numOfPoints = range.NumberOfCells;

            if (numOfPoints == 0)
            {
                // Nothing to do.
                return null;
            }

            XSSFNumberCache cache = new XSSFNumberCache(ctNumRef.AddNewNumCache());
            cache.SetPointCount(numOfPoints);

            IWorkbook wb = marker.Sheet.Workbook;
            IFormulaEvaluator Evaluator = wb.GetCreationHelper().CreateFormulaEvaluator();

            CellWalk cellWalk = new CellWalk(marker);
            NumCacheCellHandler numCacheHandler = new NumCacheCellHandler(Evaluator, cache.ctNumData);
            cellWalk.Traverse(numCacheHandler);
            return cache;
        }
예제 #2
0
파일: Chart.cs 프로젝트: runningwater/npoi
 public CT_NumRef AddNewNumRef()
 {
     this.numRefField = new CT_NumRef();
     return this.numRefField;
 }
예제 #3
0
파일: Chart.cs 프로젝트: runningwater/npoi
 public static CT_NumRef Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_NumRef ctObj = new CT_NumRef();
     ctObj.extLst = new List<CT_Extension>();
     foreach (XmlNode childNode in node.ChildNodes)
     {
         if (childNode.LocalName == "f")
             ctObj.f = childNode.InnerText;
         else if (childNode.LocalName == "numCache")
             ctObj.numCache = CT_NumData.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "extLst")
             ctObj.extLst.Add(CT_Extension.Parse(childNode, namespaceManager));
     }
     return ctObj;
 }