Exemple #1
0
 internal static void Map(Font font, DocumentObjectModel.Document domDocument, string domStyleName)
 {
     DocumentObjectModel.Style domStyle = domDocument.Styles[domStyleName];
     if (domStyle != null)
     {
         FontMapper mapper = new FontMapper();
         mapper.MapObject(font, domStyle.Font);
     }
 }
Exemple #2
0
 public static void Map(Font font, DocumentObjectModel.Document domDocument, string domStyleName)
 {
     DocumentObjectModel.Style domStyle = domDocument.Styles[domStyleName];
     if (domStyle != null)
     {
         FontMapper mapper = new FontMapper();
         mapper.MapObject(font, domStyle.Font);
     }
 }
Exemple #3
0
        private ChartFrame MapObject(DocumentObjectModel.Shapes.Charts.Chart domChart)
        {
            ChartFrame chartFrame = new ChartFrame();

            chartFrame.Size     = new XSize(domChart.Width.Point, domChart.Height.Point);
            chartFrame.Location = new XPoint(domChart.Left.Position.Point, domChart.Top.Position.Point);

            Chart chart = new Chart((ChartType)domChart.Type);

            if (!domChart.IsNull("XAxis"))
            {
                AxisMapper.Map(chart.XAxis, domChart.XAxis);
            }
            if (!domChart.IsNull("YAxis"))
            {
                AxisMapper.Map(chart.YAxis, domChart.YAxis);
            }

            PlotAreaMapper.Map(chart.PlotArea, domChart.PlotArea);

            SeriesCollectionMapper.Map(chart.SeriesCollection, domChart.SeriesCollection);

            LegendMapper.Map(chart, domChart);

            chart.DisplayBlanksAs = (BlankType)domChart.DisplayBlanksAs;
            chart.HasDataLabel    = domChart.HasDataLabel;
            if (!domChart.IsNull("DataLabel"))
            {
                DataLabelMapper.Map(chart.DataLabel, domChart.DataLabel);
            }

            if (!domChart.IsNull("Style"))
            {
                FontMapper.Map(chart.Font, domChart.Document, domChart.Style);
            }
            if (!domChart.IsNull("Format.Font"))
            {
                FontMapper.Map(chart.Font, domChart.Format.Font);
            }
            if (!domChart.IsNull("XValues"))
            {
                XValuesMapper.Map(chart.XValues, domChart.XValues);
            }

            chartFrame.Add(chart);
            return(chartFrame);
        }
Exemple #4
0
 void MapObject(DataLabel dataLabel, DocumentObjectModel.Shapes.Charts.DataLabel domDataLabel)
 {
     if (!domDataLabel.IsNull("Style"))
     {
         FontMapper.Map(dataLabel.Font, domDataLabel.Document, domDataLabel.Style);
     }
     if (!domDataLabel.IsNull("Font"))
     {
         FontMapper.Map(dataLabel.Font, domDataLabel.Font);
     }
     dataLabel.Format = domDataLabel.Format;
     if (!domDataLabel.IsNull("Position"))
     {
         dataLabel.Position = (DataLabelPosition)domDataLabel.Position;
     }
     if (!domDataLabel.IsNull("Type"))
     {
         dataLabel.Type = (DataLabelType)domDataLabel.Type;
     }
 }
        void MapObject(Chart chart, DocumentObjectModel.Shapes.Charts.Chart domChart)
        {
            DocumentObjectModel.Shapes.Charts.Legend   domLegend = null;
            DocumentObjectModel.Shapes.Charts.TextArea textArea  = null;

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.BottomArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = DockingType.Bottom;
                    domLegend            = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea             = domChart.BottomArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.RightArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = DockingType.Right;
                    domLegend            = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea             = domChart.RightArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.LeftArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = DockingType.Left;
                    domLegend            = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea             = domChart.LeftArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.TopArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = DockingType.Top;
                    domLegend            = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea             = domChart.TopArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.HeaderArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = DockingType.Top;
                    domLegend            = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea             = domChart.HeaderArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.FooterArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = DockingType.Bottom;
                    domLegend            = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea             = domChart.FooterArea;
                }
            }

            if (domLegend != null)
            {
                if (!domLegend.IsNull("LineFormat"))
                {
                    LineFormatMapper.Map(chart.Legend.LineFormat, domLegend.LineFormat);
                }
                if (!textArea.IsNull("Style"))
                {
                    FontMapper.Map(chart.Legend.Font, textArea.Document, textArea.Style);
                }
                if (!domLegend.IsNull("Format.Font"))
                {
                    FontMapper.Map(chart.Legend.Font, domLegend.Format.Font);
                }
            }
        }
Exemple #6
0
        static void MapObject(Axis axis, DocumentObjectModel.Shapes.Charts.Axis domAxis)
        {
            if (!domAxis.IsNull("TickLabels.Format"))
            {
                axis.TickLabels.Format = domAxis.TickLabels.Format;
            }
            if (!domAxis.IsNull("TickLabels.Style"))
            {
                FontMapper.Map(axis.TickLabels.Font, domAxis.TickLabels.Document, domAxis.TickLabels.Style);
            }
            if (!domAxis.IsNull("TickLabels.Font"))
            {
                FontMapper.Map(axis.TickLabels.Font, domAxis.TickLabels.Font);
            }

            if (!domAxis.IsNull("MajorTickMark"))
            {
                axis.MajorTickMark = (TickMarkType)domAxis.MajorTickMark;
            }
            if (!domAxis.IsNull("MinorTickMark"))
            {
                axis.MinorTickMark = (TickMarkType)domAxis.MinorTickMark;
            }

            if (!domAxis.IsNull("MajorTick"))
            {
                axis.MajorTick = domAxis.MajorTick;
            }
            if (!domAxis.IsNull("MinorTick"))
            {
                axis.MinorTick = domAxis.MinorTick;
            }

            if (!domAxis.IsNull("Title"))
            {
                axis.Title.Caption = domAxis.Title.Caption;
                if (!domAxis.IsNull("Title.Style"))
                {
                    FontMapper.Map(axis.Title.Font, domAxis.Title.Document, domAxis.Title.Style);
                }
                if (!domAxis.IsNull("Title.Font"))
                {
                    FontMapper.Map(axis.Title.Font, domAxis.Title.Font);
                }
                axis.Title.Orientation       = domAxis.Title.Orientation.Value;
                axis.Title.Alignment         = (HorizontalAlignment)domAxis.Title.Alignment;
                axis.Title.VerticalAlignment = (VerticalAlignment)domAxis.Title.VerticalAlignment;
            }

            axis.HasMajorGridlines = domAxis.HasMajorGridlines;
            axis.HasMinorGridlines = domAxis.HasMinorGridlines;

            if (!domAxis.IsNull("MajorGridlines") && !domAxis.MajorGridlines.IsNull("LineFormat"))
            {
                LineFormatMapper.Map(axis.MajorGridlines.LineFormat, domAxis.MajorGridlines.LineFormat);
            }
            if (!domAxis.IsNull("MinorGridlines") && !domAxis.MinorGridlines.IsNull("LineFormat"))
            {
                LineFormatMapper.Map(axis.MinorGridlines.LineFormat, domAxis.MinorGridlines.LineFormat);
            }

            if (!domAxis.IsNull("MaximumScale"))
            {
                axis.MaximumScale = domAxis.MaximumScale;
            }
            if (!domAxis.IsNull("MinimumScale"))
            {
                axis.MinimumScale = domAxis.MinimumScale;
            }

            if (!domAxis.IsNull("LineFormat"))
            {
                LineFormatMapper.Map(axis.LineFormat, domAxis.LineFormat);
            }
        }
Exemple #7
0
 internal static void Map(Font font, DocumentObjectModel.Font domFont)
 {
     FontMapper mapper = new FontMapper();
     mapper.MapObject(font, domFont);
 }
Exemple #8
0
        public static void Map(Font font, DocumentObjectModel.Font domFont)
        {
            FontMapper mapper = new FontMapper();

            mapper.MapObject(font, domFont);
        }
        internal static void Map(Font font, MigraDoc.DocumentObjectModel.Font domFont)
        {
            FontMapper mapper = new FontMapper();

            mapper.MapObject(font, domFont);
        }