예제 #1
0
        public override string ToString()
        {
            string str  = this.IsRowRelative ? ExcelRowCollection.RowIndexToName(this.row) : (AbsoluteCellMark + ExcelRowCollection.RowIndexToName(this.row));
            string str2 = this.IsColumnRelative ? ExcelColumnCollection.ColumnIndexToName(this.column) : (AbsoluteCellMark + ExcelColumnCollection.ColumnIndexToName(this.column));

            return(str2 + str);
        }
예제 #2
0
 internal ExcelWorksheet(string name, ExcelWorksheetCollection parent)
 {
     this.defaultColumnWidth = 2340;
     this.pageBreakViewZoom  = 60;
     this.zoom                      = 100;
     this.windowOptions             = WorksheetWindowOptions.DefaultGridLineColor | WorksheetWindowOptions.ShowGridLines | WorksheetWindowOptions.ShowOutlineSymbols | WorksheetWindowOptions.ShowSheetHeaders | WorksheetWindowOptions.ShowZeroValues;
     this.paperSize                 = 0;
     this.scalingFactor             = 100;
     this.startPageNumber           = 1;
     this.fitWorksheetWidthToPages  = 0;
     this.fitWorksheetHeightToPages = 0;
     this.setupOptions              = SetupOptions.Portrait;
     this.printResolution           = 0;
     this.verticalPrintResolution   = 0;
     this.headerMargin              = 0.5;
     this.footerMargin              = 0.5;
     this.numberOfCopies            = 1;
     this.WSBoolOpt                 = WSBoolOptions.ColGroupRight | WSBoolOptions.RowGroupBelow | WSBoolOptions.ShowAutoBreaks | WSBoolOptions.ShowColumnOutline | WSBoolOptions.ShowRowOutline;
     this.name                      = name;
     this.parent                    = parent;
     this.rows                      = new ExcelRowCollection(this);
     this.columns                   = new ExcelColumnCollection(this);
     this.mergedRanges              = new MergedCellRanges(this);
     this.horizontalPageBreaks      = new HorizontalPageBreakCollection();
     this.verticalPageBreaks        = new VerticalPageBreakCollection();
     this.pictures                  = new ExcelPictureCollection(this);
     this.shapes                    = new ExcelShapeCollection(this);
     this.printOptions              = new ExcelPrintOptions(this);
     this.viewOptions               = new ExcelViewOptions(this);
 }
예제 #3
0
        public ExcelCell this[string contextName]
        {
            get
            {
                int firstRow;
                int firstColumn;
                switch (this.IndexingMode)
                {
                case RangeIndexingMode.Rectangular:
                    PositionToRowColumn(contextName, out firstRow, out firstColumn);
                    break;

                case RangeIndexingMode.Horizontal:
                    firstRow    = this.firstRow;
                    firstColumn = ExcelColumnCollection.ColumnNameToIndex(contextName);
                    break;

                case RangeIndexingMode.Vertical:
                    firstRow    = ExcelRowCollection.RowNameToIndex(contextName);
                    firstColumn = this.firstColumn;
                    break;

                default:
                    throw new Exception("Internal: Unknown indexing mode.");
                }
                this.ExceptionIfRowColumnOutOfRange(firstRow, firstColumn);
                return(base.Parent.Rows[firstRow].AllocatedCells[firstColumn]);
            }
        }
예제 #4
0
 internal ExcelColumnCollection(ExcelWorksheet parent, ExcelColumnCollection sourceColumns) : base(parent)
 {
     base.MaxOutlineLevel = sourceColumns.MaxOutlineLevel;
     foreach (ExcelColumn column in sourceColumns)
     {
         base.Items.Add(new ExcelColumn(this, column));
     }
 }
예제 #5
0
 public override string ToString()
 {
     if ((this.Width <= 1) && (this.Height <= 1))
     {
         return(ExcelColumnCollection.ColumnIndexToName(this.firstColumn) + ExcelRowCollection.RowIndexToName(this.firstRow));
     }
     return(ExcelColumnCollection.ColumnIndexToName(this.firstColumn) + ExcelRowCollection.RowIndexToName(this.firstRow) + ":" + ExcelColumnCollection.ColumnIndexToName(this.lastColumn) + ExcelRowCollection.RowIndexToName(this.lastRow));
 }
예제 #6
0
        public static void SetAreaColumns(string value, out byte firstColumn, out byte lastColumn)
        {
            firstColumn = 0;
            lastColumn  = 0;
            Match match = IsCellRangeRegex.Match(value);

            firstColumn = (byte)ExcelColumnCollection.ColumnNameToIndex(match.Groups["Column1"].Value);
            lastColumn  = (byte)ExcelColumnCollection.ColumnNameToIndex(match.Groups["Column2"].Value);
        }
예제 #7
0
        public override string ToString()
        {
            string str  = this.IsFirstRowRelative ? ExcelRowCollection.RowIndexToName(this.FirstRow) : (RefFormulaToken.AbsoluteCellMark + ExcelRowCollection.RowIndexToName(this.FirstRow));
            string str2 = this.IsLastRowRelative ? ExcelRowCollection.RowIndexToName(this.LastRow) : (RefFormulaToken.AbsoluteCellMark + ExcelRowCollection.RowIndexToName(this.LastRow));
            string str3 = this.IsFirstColumnRelative ? ExcelColumnCollection.ColumnIndexToName(this.FirstColumn) : (RefFormulaToken.AbsoluteCellMark + ExcelColumnCollection.ColumnIndexToName(this.FirstColumn));
            string str4 = this.IsLastColumnAbsolute ? ExcelColumnCollection.ColumnIndexToName(this.LastColumn) : (RefFormulaToken.AbsoluteCellMark + ExcelColumnCollection.ColumnIndexToName(this.LastColumn));

            return(str3 + str + ":" + str4 + str2);
        }
예제 #8
0
 internal ExcelWorksheet(string name, ExcelWorksheetCollection parent, ExcelWorksheet sourceWorksheet)
 {
     this.defaultColumnWidth = 2340;
     this.pageBreakViewZoom  = 60;
     this.zoom                      = 100;
     this.windowOptions             = WorksheetWindowOptions.DefaultGridLineColor | WorksheetWindowOptions.ShowGridLines | WorksheetWindowOptions.ShowOutlineSymbols | WorksheetWindowOptions.ShowSheetHeaders | WorksheetWindowOptions.ShowZeroValues;
     this.paperSize                 = 0;
     this.scalingFactor             = 100;
     this.startPageNumber           = 1;
     this.fitWorksheetWidthToPages  = 0;
     this.fitWorksheetHeightToPages = 0;
     this.setupOptions              = SetupOptions.Portrait;
     this.printResolution           = 0;
     this.verticalPrintResolution   = 0;
     this.headerMargin              = 0.5;
     this.footerMargin              = 0.5;
     this.numberOfCopies            = 1;
     this.WSBoolOpt                 = WSBoolOptions.ColGroupRight | WSBoolOptions.RowGroupBelow | WSBoolOptions.ShowAutoBreaks | WSBoolOptions.ShowColumnOutline | WSBoolOptions.ShowRowOutline;
     this.name                      = name;
     this.parent                    = parent;
     this.protectedWorksheet        = sourceWorksheet.protectedWorksheet;
     this.rows                      = new ExcelRowCollection(this, sourceWorksheet.rows);
     this.columns                   = new ExcelColumnCollection(this, sourceWorksheet.columns);
     this.defaultColumnWidth        = sourceWorksheet.defaultColumnWidth;
     this.mergedRanges              = new MergedCellRanges(this, sourceWorksheet.mergedRanges);
     this.WSBoolOpt                 = sourceWorksheet.WSBoolOpt;
     if (sourceWorksheet.PreservedWorksheetRecords != null)
     {
         this.PreservedWorksheetRecords = new PreservedRecords(sourceWorksheet.PreservedWorksheetRecords);
     }
     this.windowOptions      = sourceWorksheet.windowOptions & ~(WorksheetWindowOptions.SheetSelected | WorksheetWindowOptions.SheetVisible);
     this.firstVisibleRow    = sourceWorksheet.firstVisibleRow;
     this.firstVisibleColumn = sourceWorksheet.firstVisibleColumn;
     this.pageBreakViewZoom  = sourceWorksheet.pageBreakViewZoom;
     this.zoom = sourceWorksheet.zoom;
     this.horizontalPageBreaks      = new HorizontalPageBreakCollection(sourceWorksheet.horizontalPageBreaks);
     this.verticalPageBreaks        = new VerticalPageBreakCollection(sourceWorksheet.verticalPageBreaks);
     this.paperSize                 = sourceWorksheet.paperSize;
     this.scalingFactor             = sourceWorksheet.scalingFactor;
     this.startPageNumber           = sourceWorksheet.startPageNumber;
     this.fitWorksheetWidthToPages  = sourceWorksheet.fitWorksheetWidthToPages;
     this.fitWorksheetHeightToPages = sourceWorksheet.fitWorksheetHeightToPages;
     this.setupOptions              = sourceWorksheet.setupOptions;
     this.printResolution           = sourceWorksheet.printResolution;
     this.verticalPrintResolution   = sourceWorksheet.verticalPrintResolution;
     this.headerMargin              = sourceWorksheet.headerMargin;
     this.footerMargin              = sourceWorksheet.footerMargin;
     this.numberOfCopies            = sourceWorksheet.numberOfCopies;
     this.namedRanges               = new NamedRangeCollection(this, sourceWorksheet.NamedRanges);
     this.pictures     = new ExcelPictureCollection(this, sourceWorksheet.Pictures);
     this.shapes       = new ExcelShapeCollection(this, sourceWorksheet.Shapes);
     this.printOptions = new ExcelPrintOptions(this);
     this.viewOptions  = new ExcelViewOptions(this);
 }
예제 #9
0
 private void AdjustArraySize(int index)
 {
     if (index > (base.Items.Count - 1))
     {
         ExcelColumnCollection.ExceptionIfColumnOutOfRange(index);
         int num = index - (base.Items.Count - 1);
         for (int i = 0; i < num; i++)
         {
             base.Items.Add(new ExcelCell(base.Parent));
         }
     }
 }
예제 #10
0
 private void SetLastColumn(string column)
 {
     if (column[0] == RefFormulaToken.AbsoluteCellMark)
     {
         this.IsLastColumnAbsolute = false;
         column = column.Substring(1);
     }
     else
     {
         this.IsLastColumnAbsolute = true;
     }
     this.lastColumn = (byte)ExcelColumnCollection.ColumnNameToIndex(column);
 }
예제 #11
0
 private void SetColumn(string column)
 {
     if (column[(0)] == AbsoluteCellMark)
     {
         this.IsColumnRelative = false;
         column = column.Substring(1);
     }
     else
     {
         this.IsColumnRelative = true;
     }
     this.column = (byte)ExcelColumnCollection.ColumnNameToIndex(column);
 }
예제 #12
0
        private static bool IsValidCell(Match regexMatch)
        {
            string name = regexMatch.Groups["Row"].Value;

            if (name[0] == AbsoluteCellMark)
            {
                name = name.Remove(0, 1);
            }
            string str2 = regexMatch.Groups["Column"].Value;

            if (str2[0] == AbsoluteCellMark)
            {
                str2 = str2.Remove(0, 1);
            }
            return(IsColumnValid(ExcelColumnCollection.ColumnNameToIndex(str2)) && IsRowValid(ExcelRowCollection.RowNameToIndex(name)));
        }
예제 #13
0
        internal static void PositionToRowColumn(string position, out int row, out int column, out bool wrongFormat)
        {
            string name = position.Split(new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9' }, 2)[0];

            if ((name.Length != 0) && (name.Length != position.Length))
            {
                string str2 = position.Remove(0, name.Length);
                row         = ExcelRowCollection.RowNameToIndex(str2);
                column      = ExcelColumnCollection.ColumnNameToIndex(name);
                wrongFormat = false;
            }
            else
            {
                column      = -1;
                row         = -1;
                wrongFormat = true;
            }
        }
예제 #14
0
 internal CellRange(ExcelWorksheet parent, int firstRow, int firstColumn, int lastRow, int lastColumn) : base(parent)
 {
     ExcelRowCollection.ExceptionIfRowOutOfRange(firstRow);
     ExcelColumnCollection.ExceptionIfColumnOutOfRange(firstColumn);
     ExcelRowCollection.ExceptionIfRowOutOfRange(lastRow);
     ExcelColumnCollection.ExceptionIfColumnOutOfRange(lastColumn);
     if (lastRow < firstRow)
     {
         throw new ArgumentOutOfRangeException("", lastRow, "Argument lastRow can't be smaller than firstRow.");
     }
     if (lastColumn < firstColumn)
     {
         throw new ArgumentOutOfRangeException("", lastColumn, "Argument lastColumn can't be smaller than firstColumn.");
     }
     this.firstRow    = firstRow;
     this.firstColumn = firstColumn;
     this.lastRow     = lastRow;
     this.lastColumn  = lastColumn;
 }
예제 #15
0
파일: ExcelColumn.cs 프로젝트: ikvm/test
 internal ExcelColumn(ExcelColumnCollection parent, int index) : base(parent, index)
 {
     this.width = -1;
 }
예제 #16
0
 public static byte CellToColumn(string value)
 {
     return((byte)ExcelColumnCollection.ColumnNameToIndex(IsCellRegex.Match(value).Groups["Column"].Value));
 }
예제 #17
0
파일: ExcelColumn.cs 프로젝트: ikvm/test
 internal ExcelColumn(ExcelColumnCollection parent, ExcelColumn sourceColumn) : base(parent, (ExcelColumnRowBase)sourceColumn)
 {
     this.width = -1;
     this.width = sourceColumn.width;
 }
예제 #18
0
 public static string RowColumnToPosition(int row, int column)
 {
     return(ExcelColumnCollection.ColumnIndexToName(column) + ExcelRowCollection.RowIndexToName(row));
 }