Esempio n. 1
0
        internal Worksheet(ExcelXmlWorkbook parent)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }

            ParentBook = parent;

            PrintOptions = new PrintOptions();

            PrintOptions.Layout      = PageLayout.None;
            PrintOptions.Orientation = PageOrientation.None;

            _Rows        = new List <Row>();
            _Columns     = new List <Column>();
            _MergedCells = new List <Range>();

            TabColor = -1;

            PrintOptions.FitHeight = 1;
            PrintOptions.FitWidth  = 1;
            PrintOptions.Scale     = 100;

            PrintOptions.ResetMargins();
        }
Esempio n. 2
0
        internal List <string> CellInNamedRanges(Cell cell)
        {
            List <string> ranges = new List <string>();

            PrintOptions po = cell.ParentRow.ParentSheet.PrintOptions;

            if (po.PrintTitles)
            {
                int cellRowIndex = cell.ParentRow.RowIndex + 1;
                int cellColIndex = cell.CellIndex + 1;

                if (cellRowIndex >= po.TopPrintRow && cellRowIndex <= po.BottomPrintRow)
                {
                    ranges.Add("Print_Titles");
                }
                else
                {
                    if (cellColIndex >= po.LeftPrintCol && cellColIndex <= po.RightPrintCol)
                    {
                        ranges.Add("Print_Titles");
                    }
                }
            }

            foreach (NamedRange nr in NamedRanges)
            {
                if (nr.Range.Contains(cell))
                {
                    ranges.Add(nr.Name);
                }
            }

            return(ranges);
        }
Esempio n. 3
0
        private void ExportOptions(XmlWriter writer)
        {
            // Start Worksheet options
            writer.WriteStartElement("", "WorksheetOptions", "urn:schemas-microsoft-com:office:excel");

            PrintOptions.Export(writer);

            writer.WriteElementString("Selected", "");

            if (TabColor != -1)
            {
                writer.WriteElementString("TabColor", TabColor.ToString(
                                              CultureInfo.InvariantCulture));
            }

            // Pane Info
            if (FreezeLeftColumns > 0 || FreezeTopRows > 0)
            {
                writer.WriteElementString("FreezePanes", "");
                writer.WriteElementString("FrozenNoSplit", "");

                if (FreezeTopRows > 0)
                {
                    writer.WriteElementString("SplitHorizontal", FreezeTopRows.ToString(
                                                  CultureInfo.InvariantCulture));
                    writer.WriteElementString("TopRowBottomPane", FreezeTopRows.ToString(
                                                  CultureInfo.InvariantCulture));
                }
                if (FreezeLeftColumns > 0)
                {
                    writer.WriteElementString("SplitVertical", FreezeLeftColumns.ToString(
                                                  CultureInfo.InvariantCulture));
                    writer.WriteElementString("LeftColumnRightPane", FreezeLeftColumns.ToString(
                                                  CultureInfo.InvariantCulture));
                }

                // Panes
                WritePanes(writer);
            }

            // End Worksheet options
            writer.WriteEndElement();
        }