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); }
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); }
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]); } }
internal ExcelRowCollection(ExcelWorksheet parent, ExcelRowCollection sourceRows) : base(parent) { base.MaxOutlineLevel = sourceRows.MaxOutlineLevel; foreach (ExcelRow row in sourceRows) { base.Items.Add(new ExcelRow(this, row)); } }
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)); }
public static void SetAreaRows(string value, out ushort firstRow, out ushort lastRow) { firstRow = 0; lastRow = 0; Match match = IsCellRangeRegex.Match(value); firstRow = (ushort)ExcelRowCollection.RowNameToIndex(match.Groups["Row1"].Value); lastRow = (ushort)ExcelRowCollection.RowNameToIndex(match.Groups["Row2"].Value); }
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); }
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); }
private void SetLastRow(string row) { if (row[0] == RefFormulaToken.AbsoluteCellMark) { this.IsLastRowRelative = false; row = row.Substring(1); } else { this.IsLastRowRelative = true; } this.lastRow = (ushort)ExcelRowCollection.RowNameToIndex(row); }
private void SetRow(string row) { if (row[(0)] == AbsoluteCellMark) { this.IsRowRelative = false; row = row.Substring(1); } else { this.IsRowRelative = true; } this.row = (ushort)ExcelRowCollection.RowNameToIndex(row); }
internal CellRangeEnumerator(CellRange parent, bool onlyAllocated) { this.parent = parent; this.onlyAllocated = onlyAllocated; this.rowCollection = this.parent.Parent.Rows; if (this.onlyAllocated) { this.rowLimit = Math.Min(this.rowCollection.Count - 1, this.parent.LastRowIndex); } else { this.rowLimit = this.parent.LastRowIndex; } this.Reset(); }
public void InsertCopy(int columnCount, ExcelColumn sourceColumn) { ExcelRowCollection rows = sourceColumn.Parent.Parent.Rows; int num = 0; foreach (ExcelRow row in base.Parent.Parent.Rows) { ExcelCellCollection allocatedCells = rows[num].AllocatedCells; ExcelCell sourceCell = null; if (allocatedCells.Count > sourceColumn.Index) { sourceCell = allocatedCells[sourceColumn.Index]; } row.AllocatedCells.Insert(base.Index, columnCount, sourceCell); num++; } ((ExcelColumnCollection)base.Parent).InsertInternal(base.Index, columnCount, sourceColumn); }
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; } }
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; }
internal ExcelRow(ExcelRowCollection parent, ExcelRow sourceRow) : base(parent, (ExcelColumnRowBase)sourceRow) { this.height = 255; this.height = sourceRow.height; this.cellCollection = new ExcelCellCollection(parent.Parent, sourceRow.cellCollection); }
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))); }
public static ushort CellToRow(string value) { return((ushort)ExcelRowCollection.RowNameToIndex(IsCellRegex.Match(value).Groups["Row"].Value)); }
internal ExcelRow(ExcelRowCollection parent, int index) : base(parent, index) { this.height = 255; this.cellCollection = new ExcelCellCollection(parent.Parent); }
public static string RowColumnToPosition(int row, int column) { return(ExcelColumnCollection.ColumnIndexToName(column) + ExcelRowCollection.RowIndexToName(row)); }