void MapObject(PlotArea plotArea, DocumentObjectModel.Shapes.Charts.PlotArea domPlotArea) { plotArea.BottomPadding = domPlotArea.BottomPadding.Point; plotArea.RightPadding = domPlotArea.RightPadding.Point; plotArea.LeftPadding = domPlotArea.LeftPadding.Point; plotArea.TopPadding = domPlotArea.TopPadding.Point; if (!domPlotArea.IsNull("LineFormat")) LineFormatMapper.Map(plotArea.LineFormat, domPlotArea.LineFormat); if (!domPlotArea.IsNull("FillFormat")) FillFormatMapper.Map(plotArea.FillFormat, domPlotArea.FillFormat); }
void MapObject(Font font, DocumentObjectModel.Font domFont) { font.Bold = domFont.Bold; if (domFont.Color.IsEmpty) font.Color = XColor.Empty; else { #if noCMYK font.Color = XColor.FromArgb((int)domFont.Color.Argb); #else font.Color = ColorHelper.ToXColor(domFont.Color, domFont.Document.UseCmykColor); #endif } font.Italic = domFont.Italic; if (!domFont.IsNull("Name")) font.Name = domFont.Name; if (!domFont.IsNull("Size")) font.Size = domFont.Size.Point; font.Subscript = domFont.Subscript; font.Superscript = domFont.Superscript; font.Underline = (Underline)domFont.Underline; }
void MapObject(LineFormat lineFormat, DocumentObjectModel.Shapes.LineFormat domLineFormat) { if (domLineFormat.Color.IsEmpty) lineFormat.Color = XColor.Empty; else { #if noCMYK lineFormat.Color = XColor.FromArgb(domLineFormat.Color.Argb); #else lineFormat.Color = ColorHelper.ToXColor(domLineFormat.Color, domLineFormat.Document.UseCmykColor); #endif } switch (domLineFormat.DashStyle) { case DocumentObjectModel.Shapes.DashStyle.Dash: lineFormat.DashStyle = XDashStyle.Dash; break; case DocumentObjectModel.Shapes.DashStyle.DashDot: lineFormat.DashStyle = XDashStyle.DashDot; break; case DocumentObjectModel.Shapes.DashStyle.DashDotDot: lineFormat.DashStyle = XDashStyle.DashDotDot; break; case DocumentObjectModel.Shapes.DashStyle.Solid: lineFormat.DashStyle = XDashStyle.Solid; break; case DocumentObjectModel.Shapes.DashStyle.SquareDot: lineFormat.DashStyle = XDashStyle.Dot; break; default: lineFormat.DashStyle = XDashStyle.Solid; break; } switch (domLineFormat.Style) { case DocumentObjectModel.Shapes.LineStyle.Single: lineFormat.Style = LineStyle.Single; break; } lineFormat.Visible = domLineFormat.Visible; if (domLineFormat.IsNull("Visible")) lineFormat.Visible = true; lineFormat.Width = domLineFormat.Width.Point; }
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); }
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; }