Ejemplo n.º 1
0
        /***********************************
         * DAL METHODS
         ************************************/
        // Read
        internal static PrintOptions ReadPrintOptionsFromReader(CustomOpenXmlReader reader, Worksheet worksheet)
        {
            PrintOptions printOptions = new PrintOptions(worksheet);

            foreach (CustomOpenXmlAttribute attribute in reader.Attributes)
            {
                switch (attribute.LocalName)
                {
                    case "horizontalCentered":
                        printOptions.HorizontalCentered = attribute.GetBoolValue();
                        break;
                    case "verticalCentered":
                        printOptions.VerticalCentered = attribute.GetBoolValue();
                        break;
                    case "gridLines":
                        printOptions.GridLines = attribute.GetBoolValue();
                        break;
                    case "headings":
                        printOptions.Headings = attribute.GetBoolValue();
                        break;
                    default:
                        throw new Exception(string.Format("PrintOptions attribute {0} not coded", attribute.LocalName));
                }
            }

            return printOptions;
        }
Ejemplo n.º 2
0
 /***********************************
  * INTERNAL METHODS
  ************************************/
 internal PrintOptions Clone(Worksheet worksheet)
 {
     PrintOptions newPrintOptions = new PrintOptions(worksheet, HorizontalCentered, VerticalCentered, GridLines, Headings);
     return newPrintOptions;
 }
Ejemplo n.º 3
0
        // Write
        internal static void WritePrintOptionsToWriter(CustomOpenXmlWriter<OpenXmlPackaging.WorksheetPart> writer, PrintOptions printOptions)
        {
            if (printOptions.HasValue())
            {
                writer.WriteOpenXmlElement(new OpenXmlSpreadsheet.PrintOptions());

                if (printOptions.HorizontalCentered) writer.WriteAttribute("horizontalCentered", printOptions.HorizontalCentered);
                if (printOptions.VerticalCentered) writer.WriteAttribute("verticalCentered", printOptions.VerticalCentered);
                if (printOptions.GridLines) writer.WriteAttribute("gridLines", printOptions.GridLines);
                if (printOptions.Headings) writer.WriteAttribute("headings", printOptions.Headings);

                writer.WriteEndElement();   // PrintOptions
            }
        }