Ejemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="xmlFilePath"></param>
 /// <param name="worksheetName"></param>
 /// <param name="startCell">the area could be defined by startCell (upperLeft cell) </param>
 /// <param name="endCell">and the endCell (bottom right cell)</param>
 public OpenXMLDataAdapter(string xmlFilePath, string worksheetName, string startCell, string endCell, bool withHeaderOnFirstRow = true)
 {
     STRING_TYPE        = System.Type.GetType("System.String");
     this.XMLFilePath   = xmlFilePath;
     this.WorksheetName = worksheetName;
     if (startCell == null)
     {
         this.StartCell_Column = 0;
         this.StartCell_Row    = 0;
     }
     else
     {
         double[] c = OpenXMLDataAdapter.GetColumnRowXY(startCell);
         this.StartCell_Column = c[0];
         this.StartCell_Row    = c[1];
     }
     if (endCell == null)
     {
         this.EndCell_Column = double.MaxValue;
         this.EndCell_Row    = double.MaxValue;
     }
     else
     {
         double[] c = OpenXMLDataAdapter.GetColumnRowXY(endCell);
         this.EndCell_Column = c[0];
         this.EndCell_Row    = c[1];
     }
     this.WithHeaderOnFirstRow = withHeaderOnFirstRow;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// return the transformation of the recorded cell. the StartCell will be the (0,0)
        /// </summary>
        /// <param name="c"></param>
        /// <returns></returns>
        private double[] GetRecordedCellXY(string cellReference, out double[] coord)
        {
            coord = OpenXMLDataAdapter.GetColumnRowXY(cellReference);

            if (this.StartCell_Column <= coord[0])
            {
                if (this.StartCell_Row <= coord[1])
                {
                    if (this.EndCell_Column >= coord[0])
                    {
                        if (this.EndCell_Row >= coord[1])
                        {
                            return(new double[] { coord[0] - this.StartCell_Column, coord[1] - this.StartCell_Row });
                        }
                    }
                }
            }
            return(null);
        }