/**
         * Called when a column is removed on the specified sheet.  Notifies all
         * RCIR cells of this change
         *
         * @param s the sheet on which the column was removed
         * @param col the column number which was removed
         */
        public virtual void columnRemoved(WritableSheetImpl s, int col)
        {
            int externalSheetIndex = getExternalSheetIndex(s.getName());
            foreach (CellValue cv in rcirCells)
                cv.columnRemoved(s, externalSheetIndex, col);

            // Adjust any named cells
            ArrayList removedNames = new ArrayList();
            if (names != null)
                {
                foreach (NameRecord nameRecord in names)
                    {
                    bool removeName = nameRecord.columnRemoved(externalSheetIndex,col);

                    if (removeName)
                        removedNames.Add(nameRecord);
                    }

                // Remove any names which have been deleted
                foreach (NameRecord nameRecord in removedNames)
                    names.Remove(nameRecord);
                }
        }
 /**
  * Overrides the method in the base class to add this to the Workbook's
  * list of maintained formulas
  *
  * @param fr the formatting records
  * @param ss the shared strings used within the workbook
  * @param s the sheet this is being added to
  */
 public override void setCellDetails(FormattingRecords fr, SharedStrings ss,
     WritableSheetImpl s)
 {
     base.setCellDetails(fr, ss, s);
     s.getWorkbook().addRCIRCell(this);
 }
        /**
         * The internal method implementation for creating new sheets
         *
         * @param name
         * @param index
         * @param handleRefs flag indicating whether or not to handle external
         *                   sheet references
         * @return
         */
        private WritableSheet createSheet(string name, int index,bool handleRefs)
        {
            WritableSheet w = new WritableSheetImpl(name,outputFile,formatRecords,sharedStrings,settings,this);

            int pos = index;
            if (index <= 0)
                {
                pos = 0;
                sheets.Insert(0, w);
                }
            else if (index > sheets.Count)
                {
                pos = sheets.Count;
                sheets.Add(w);
                }
            else
                {
                sheets.Insert(index, w);
                }

            if (handleRefs && externSheet != null)
                {
                externSheet.sheetInserted(pos);
                }

            if (supbooks != null && supbooks.Count > 0)
                {
                SupbookRecord supbook = (SupbookRecord)supbooks[0];
                if (supbook.getType() == SupbookRecord.INTERNAL)
                    supbook.adjustInternal(sheets.Count);
                }

            return w;
        }
        /**
         * Called when a column is inserted on the specified sheet.  Notifies all
         * RCIR cells of this change
         *
         * @param s the sheet on which the column was inserted
         * @param col the column number which was inserted
         */
        public virtual void columnInserted(WritableSheetImpl s, int col)
        {
            int externalSheetIndex = getExternalSheetIndex(s.getName());
            foreach (CellValue cv in rcirCells)
                cv.columnInserted(s, externalSheetIndex, col);

            // Adjust any named cells
            if (names != null)
                {
                foreach (NameRecord nameRecord in names)
                    nameRecord.columnInserted(externalSheetIndex, col);
                }
        }
        /**
         * Called when a row is inserted on the specified sheet.  Notifies all
         * RCIR cells of this change
         *
         * @param s the sheet on which the row was inserted
         * @param row the row number which was inserted
         */
        public virtual void rowInserted(WritableSheetImpl s, int row)
        {
            int externalSheetIndex = getExternalSheetIndex(s.getName());

            // Adjust the row infos
            foreach (CellValue cv in rcirCells)
                cv.rowInserted(s, externalSheetIndex, row);

            // Adjust any named cells
            if (names != null)
                {
                foreach (NameRecord nameRecord in names)
                    nameRecord.rowInserted(externalSheetIndex, row);
                }
        }
Exemplo n.º 6
0
        /**
         * Overrides the method in the base class in order to add the string
         * content to the shared string table, and to store its shared string
         * index
         *
         * @param fr the formatting records
         * @param ss the shared strings used within the workbook
         * @param s
         */
        public override void setCellDetails(FormattingRecords fr, SharedStrings ss,
            WritableSheetImpl s)
        {
            base.setCellDetails(fr, ss, s);

            sharedStrings = ss;

            index = sharedStrings.getIndex(contents);

            // Use the sharedStrings reference instead of this object's own
            // handle - this means that the bespoke copy becomes eligible for
            // garbage collection
            contents = sharedStrings.get(index);
        }
Exemplo n.º 7
0
 public SheetCopier(Sheet f, WritableSheet t)
 {
     fromSheet = (SheetImpl)f;
     toSheet = (WritableSheetImpl)t;
     workbookSettings = toSheet.getWorkbook().getSettings();
     chartOnly = false;
 }
Exemplo n.º 8
0
        /**
         * Called when the cell is added to the worksheet in order to indicate
         * that this object is already added to the worksheet
         * This method also verifies that the associated formats and formats
         * have been initialized correctly
         *
         * @param fr the formatting records
         * @param ss the shared strings used within the workbook
         * @param s the sheet this is being added to
         */
        public virtual void setCellDetails(FormattingRecords fr, SharedStrings ss,
            WritableSheetImpl s)
        {
            referenced = true;
            sheet = s;
            formattingRecords = fr;

            addCellFormat();
            addCellFeatures();
        }
Exemplo n.º 9
0
 /**
  * Creates a new <code>SheetWriter</code> instance.
  *
  * @param of the output file
  */
 public SheetWriter(File of,
     WritableSheetImpl wsi,
     WorkbookSettings ws)
 {
     outputFile = of;
     sheet = wsi;
     workspaceOptions = new WorkspaceInformationRecord();
     workbookSettings = ws;
     chartOnly = false;
     drawingWriter = new SheetDrawingWriter(ws);
 }