// Generates document public static void Generate(ILogger logger) { #region Cell styles var numberStyle = new XlsxCellStyle { Content = { DataType = new NumberDataType { Decimals = 1, Separator = YesNo.Yes }, Alignment = { Horizontal= KnownHorizontalAlignment.Right } } }; #endregion #region Creates xlsx file reference XlsxInput doc = XlsxInput.Create(new[] { "Hoja1", "Hoja2" }); #endregion #region Insert data doc.Insert(new InsertEnumerable <AgePerson> { SheetName = "Hoja1", Location = new XlsxPointRange { Column = 2, Row = 3 }, Data = new Collection <AgePerson> { new AgePerson { Name = "Name-01", Surname = "Surname-01", Age = 23 }, new AgePerson { Name = "Name-02", Surname = "Surname-02", Age = 7 }, new AgePerson { Name = "Name-03", Surname = "Surname-03", Age = 11 }, new AgePerson { Name = "Name-04", Surname = "Surname-04", Age = 22 }, new AgePerson { Name = "Name-05", Surname = "Surname-05", Age = 52 }, new AgePerson { Name = "Name-06", Surname = "Surname-06", Age = 33 }, new AgePerson { Name = "Name-07", Surname = "Surname-07", Age = 8 }, new AgePerson { Name = "Name-08", Surname = "Surname-08", Age = 2 }, new AgePerson { Name = "Name-09", Surname = "Surname-09", Age = 12 }, new AgePerson { Name = "Name-10", Surname = "Surname-10", Age = 21 }, } }); #endregion #region Insert aggregate functions doc.Insert(new InsertText { SheetName = "Hoja1", Data = "Count", Style = XlsxCellStyle.Default, Location = new XlsxPointRange { Column = 1, Row = 14 }, }).Insert(new InsertAggregateFunction { SheetName = "Hoja1", Style = numberStyle, Aggegate = { WorkSheet = "Hoja1", AggregateType = KnownAggregateType.Count, Range = new XlsxRange { Start = { Column = 2, Row= 4 }, End = { Column = 2, Row = 13 } } }, Location = new XlsxPointRange { Column = 2, Row = 14 } }).Insert(new InsertText { SheetName = "Hoja1", Data = "Sum", Style = XlsxCellStyle.Default, Location = new XlsxPointRange { Column = 1, Row = 15 }, }).Insert(new InsertAggregateFunction { SheetName = "Hoja1", Style = numberStyle, Aggegate = { WorkSheet = "Hoja1", AggregateType = KnownAggregateType.Sum, Range = new XlsxRange { Start = { Column = 2, Row= 4 }, End = { Column = 2, Row = 13 } } }, Location = new XlsxPointRange { Column = 2, Row = 15 } }).Insert(new InsertText { SheetName = "Hoja1", Data = "Average", Style = XlsxCellStyle.Default, Location = new XlsxPointRange { Column = 1, Row = 16 }, }).Insert(new InsertAggregateFunction { SheetName = "Hoja1", Style = numberStyle, Aggegate = { WorkSheet = "Hoja1", AggregateType = KnownAggregateType.Average, Range = new XlsxRange { Start = { Column = 2, Row= 4 }, End = { Column = 2, Row = 13 } } }, Location = new XlsxPointRange { Column = 2, Row = 16 } }).Insert(new InsertText { SheetName = "Hoja1", Data = "Max", Style = XlsxCellStyle.Default, Location = new XlsxPointRange { Column = 1, Row = 17 }, }).Insert(new InsertAggregateFunction { SheetName = "Hoja1", Style = numberStyle, Aggegate = { WorkSheet = "Hoja1", AggregateType = KnownAggregateType.Max, Range = new XlsxRange { Start = { Column = 2, Row= 4 }, End = { Column = 2, Row = 13 } } }, Location = new XlsxPointRange { Column = 2, Row = 17 } }).Insert(new InsertText { SheetName = "Hoja1", Data = "Min", Style = XlsxCellStyle.Default, Location = new XlsxPointRange { Column = 1, Row = 18 }, }).Insert(new InsertAggregateFunction { SheetName = "Hoja1", Style = numberStyle, Aggegate = { WorkSheet = "Hoja1", AggregateType = KnownAggregateType.Min, Range = new XlsxRange { Start = { Column = 2, Row= 4 }, End = { Column = 2, Row = 13 } } }, Location = new XlsxPointRange { Column = 2, Row = 18 } }); #endregion #region Create output result var result = doc.CreateResult(new OutputResultConfig { AutoFitColumns = true }); if (!result.Success) { logger.Info(" > Error creating output result"); logger.Info($" > Error: {result.Errors.AsMessages().ToStringBuilder()}"); return; } #endregion #region Saves output result var saveResult = result.Result.Action(new SaveToFile { OutputPath = "~/Output/Sample13/Sample-13" }); if (!saveResult.Success) { logger.Info(" > Error while saving to disk"); logger.Info($" > Error: {saveResult.Errors.AsMessages().ToStringBuilder()}"); return; } logger.Info(" > Saved to disk correctly"); logger.Info(" > Path: ~/Output/Sample13/Sample-13.xlsx"); #endregion }
// Generates document public static void Generate(ILogger logger) { #region Creates xlsx file reference XlsxInput doc = XlsxInput.Create(new[] { "Shadows", "Illumination", "Reflection", "Soft Edge" }); #endregion #region Cell styles var headerStyle = new XlsxCellStyle { Font = { Color = "Blue", Bold = YesNo.Yes }, Content = { Color = "LightGray", Merge = { Cells = 8 }, Pattern = { PatternType = KnownPatternType.Solid }, Alignment = { Horizontal = KnownHorizontalAlignment.Left,Vertical = KnownVerticalAlignment.Center } }, Borders = { new XlsxStyleBorder { Color = "Green", Position = KnownBorderPosition.Top, Style = KnownBorderStyle.Thick }, new XlsxStyleBorder { Color = "Green", Position = KnownBorderPosition.Bottom, Style = KnownBorderStyle.Thick } } }; var illuminationHeaderStyle = new XlsxCellStyle { Font = { Color = "Blue", Bold = YesNo.Yes }, Content = { Color = "LightGray", Alignment = { Horizontal = KnownHorizontalAlignment.Center,Vertical = KnownVerticalAlignment.Center } }, Borders = { new XlsxStyleBorder { Color = "Green", Position = KnownBorderPosition.Top, Style = KnownBorderStyle.Thick }, new XlsxStyleBorder { Color = "Green", Position = KnownBorderPosition.Bottom, Style = KnownBorderStyle.Thick } } }; var reflectionHeaderStyle = new XlsxCellStyle { Font = { Color = "Blue", Bold = YesNo.Yes }, Content = { Color = "LightGray", Merge = { Cells = 2 }, Pattern = { PatternType = KnownPatternType.Solid }, Alignment = { Horizontal = KnownHorizontalAlignment.Left,Vertical = KnownVerticalAlignment.Center } }, Borders = { new XlsxStyleBorder { Color = "Green", Position = KnownBorderPosition.Top, Style = KnownBorderStyle.Thick }, new XlsxStyleBorder { Color = "Green", Position = KnownBorderPosition.Bottom, Style = KnownBorderStyle.Thick } } }; var softEdgeHeaderStyle = new XlsxCellStyle { Font = { Color = "Blue", Bold = YesNo.Yes }, Content = { Color = "LightGray", Merge = { Cells = 2 }, Pattern = { PatternType = KnownPatternType.Solid }, Alignment = { Horizontal = KnownHorizontalAlignment.Left,Vertical = KnownVerticalAlignment.Center } }, Borders = { new XlsxStyleBorder { Color = "Green", Position = KnownBorderPosition.Top, Style = KnownBorderStyle.Thick }, new XlsxStyleBorder { Color = "Green", Position = KnownBorderPosition.Bottom, Style = KnownBorderStyle.Thick } } }; #endregion #region Sheets #region Sheet > Shadows var shadowsInsertResult = doc.Insert(new InsertText { SheetName = "Shadows", Data = "Outer shadows", Location = new XlsxPointRange { Column = 2, Row = 2 }, Style = headerStyle }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 2, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxOuterShadow.DownLeft } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 5, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxOuterShadow.Down } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 8, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxOuterShadow.DownLeft } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 2, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxOuterShadow.Left } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 5, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxOuterShadow.Center } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 8, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxOuterShadow.Right } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 2, Row = 24 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxOuterShadow.TopLeft } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 5, Row = 24 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxOuterShadow.Top } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 8, Row = 24 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxOuterShadow.TopRight } } }).Insert(new InsertText { SheetName = "Shadows", Data = "Inner shadows", Location = new XlsxPointRange { Column = 11, Row = 2 }, Style = headerStyle }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 11, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxInnerShadow.TopLeft } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 14, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxInnerShadow.Top } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 17, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxInnerShadow.TopRight } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 11, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxInnerShadow.Left } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 14, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxInnerShadow.Center } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 17, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxInnerShadow.Right } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 11, Row = 24 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxInnerShadow.DownLeft } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 14, Row = 24 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxInnerShadow.Down } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 17, Row = 24 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxInnerShadow.DownRight } } }).Insert(new InsertText { SheetName = "Shadows", Data = "Perspective shadows", Location = new XlsxPointRange { Column = 20, Row = 2 }, Style = new XlsxCellStyle { Font = { Color = "Blue", Bold = YesNo.Yes }, Content = { Color = "LightGray", Merge = { Cells = 5 }, Alignment = { Horizontal = KnownHorizontalAlignment.Left,Vertical = KnownVerticalAlignment.Center } }, Borders = { new XlsxStyleBorder { Color = "Green", Position = KnownBorderPosition.Top, Style = KnownBorderStyle.Thick }, new XlsxStyleBorder { Color = "Green", Position = KnownBorderPosition.Bottom, Style = KnownBorderStyle.Thick } } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 20, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxPerspectiveShadow.TopLeft } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 23, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxPerspectiveShadow.TopRight } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 20, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxPerspectiveShadow.DownLeft } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 23, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxPerspectiveShadow.DownRight } } }).Insert(new InsertPicture { SheetName = "Shadows", Location = new XlsxPointRange { Column = 20, Row = 24 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Shadow = XlsxPerspectiveShadow.Down } } }); #endregion #region Sheet > Illumination var illuminationInsertResult = doc.Insert(new InsertText { SheetName = "Illumination", Data = "Accent 1", Location = new XlsxPointRange { Column = 2, Row = 2 }, Style = illuminationHeaderStyle }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 2, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis1Points5 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 2, Row = 9 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis1Points8 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 2, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis1Points11 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 2, Row = 20 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis1Points18 } } }).Insert(new InsertText { SheetName = "Illumination", Data = "Accent 2", Location = new XlsxPointRange { Column = 4, Row = 2 }, Style = illuminationHeaderStyle }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 4, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis2Points5 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 4, Row = 9 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis2Points8 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 4, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis2Points11 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 4, Row = 20 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis2Points18 } } }).Insert(new InsertText { SheetName = "Illumination", Data = "Accent 3", Location = new XlsxPointRange { Column = 6, Row = 2 }, Style = illuminationHeaderStyle }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 6, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis3Points5 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 6, Row = 9 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis3Points8 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 6, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis3Points11 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 6, Row = 20 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis3Points18 } } }).Insert(new InsertText { SheetName = "Illumination", Data = "Accent 4", Location = new XlsxPointRange { Column = 8, Row = 2 }, Style = illuminationHeaderStyle }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 8, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis4Points5 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 8, Row = 9 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis4Points8 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 8, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis4Points11 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 8, Row = 20 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis4Points18 } } }).Insert(new InsertText { SheetName = "Illumination", Data = "Accent 5", Location = new XlsxPointRange { Column = 10, Row = 2 }, Style = illuminationHeaderStyle }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 10, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis5Points5 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 10, Row = 9 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis4Points8 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 10, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis5Points11 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 10, Row = 20 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis5Points18 } } }).Insert(new InsertText { SheetName = "Illumination", Data = "Accent 6", Location = new XlsxPointRange { Column = 12, Row = 2 }, Style = illuminationHeaderStyle }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 12, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis6Points5 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 12, Row = 9 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis6Points8 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 12, Row = 14 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis6Points11 } } }).Insert(new InsertPicture { SheetName = "Illumination", Location = new XlsxPointRange { Column = 12, Row = 20 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 71, Height = 71 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Illumination = XlsxIlluminationShapeEffect.Emphasis6Points18 } } }); #endregion #region Sheet > Reflection var reflectionInsertResult = doc.Insert(new InsertText { SheetName = "Reflection", Data = "Strong", Location = new XlsxPointRange { Column = 2, Row = 2 }, Style = reflectionHeaderStyle }).Insert(new InsertPicture { SheetName = "Reflection", Location = new XlsxPointRange { Column = 2, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Reflection = XlsxReflectionShapeEffect.StrongNoOffset } } }).Insert(new InsertPicture { SheetName = "Reflection", Location = new XlsxPointRange { Column = 2, Row = 20 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Reflection = XlsxReflectionShapeEffect.StrongOffset4 } } }).Insert(new InsertPicture { SheetName = "Reflection", Location = new XlsxPointRange { Column = 2, Row = 36 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Reflection = XlsxReflectionShapeEffect.StrongOffset8 } } }).Insert(new InsertText { SheetName = "Reflection", Data = "Semi", Location = new XlsxPointRange { Column = 5, Row = 2 }, Style = reflectionHeaderStyle }).Insert(new InsertPicture { SheetName = "Reflection", Location = new XlsxPointRange { Column = 5, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Reflection = XlsxReflectionShapeEffect.SemiNoOffset } } }).Insert(new InsertPicture { SheetName = "Reflection", Location = new XlsxPointRange { Column = 5, Row = 20 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Reflection = XlsxReflectionShapeEffect.SemiOffset4 } } }).Insert(new InsertPicture { SheetName = "Reflection", Location = new XlsxPointRange { Column = 5, Row = 36 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Reflection = XlsxReflectionShapeEffect.SemiOffset8 } } }).Insert(new InsertText { SheetName = "Reflection", Data = "Total", Location = new XlsxPointRange { Column = 8, Row = 2 }, Style = reflectionHeaderStyle }).Insert(new InsertPicture { SheetName = "Reflection", Location = new XlsxPointRange { Column = 8, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Reflection = XlsxReflectionShapeEffect.TotalNoOffset } } }).Insert(new InsertPicture { SheetName = "Reflection", Location = new XlsxPointRange { Column = 8, Row = 20 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Reflection = XlsxReflectionShapeEffect.TotalOffset4 } } }).Insert(new InsertPicture { SheetName = "Reflection", Location = new XlsxPointRange { Column = 8, Row = 36 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { Reflection = XlsxReflectionShapeEffect.TotalOffset8 } } }); #endregion #region Sheet > SoftEdge var softEdgeInsertResult = doc.Insert(new InsertText { SheetName = "Soft Edge", Data = "Soft edge", Location = new XlsxPointRange { Column = 2, Row = 2 }, Style = softEdgeHeaderStyle }).Insert(new InsertPicture { SheetName = "Soft Edge", Location = new XlsxPointRange { Column = 2, Row = 4 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { SoftEdge = XlsxSoftEdgeShapeEffect.SoftEdge1 } } }).Insert(new InsertPicture { SheetName = "Soft Edge", Location = new XlsxPointRange { Column = 2, Row = 12 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { SoftEdge = XlsxSoftEdgeShapeEffect.SoftEdge2 } } }).Insert(new InsertPicture { SheetName = "Soft Edge", Location = new XlsxPointRange { Column = 2, Row = 20 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { SoftEdge = XlsxSoftEdgeShapeEffect.SoftEdge5 } } }).Insert(new InsertPicture { SheetName = "Soft Edge", Location = new XlsxPointRange { Column = 2, Row = 29 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { SoftEdge = XlsxSoftEdgeShapeEffect.SoftEdge10 } } }).Insert(new InsertPicture { SheetName = "Soft Edge", Location = new XlsxPointRange { Column = 2, Row = 37 }, Picture = new XlsxPicture { Path = "~/Resources/Sample-10/bar-chart.png", Size = new XlsxSize { Width = 142, Height = 142 }, Border = { Color = "Green", Show = YesNo.Yes }, ShapeEffects = { SoftEdge = XlsxSoftEdgeShapeEffect.SoftEdge25 } } }); #endregion #endregion #region Evaluate insert(s) operation(s) if (!shadowsInsertResult.Success) { logger.Info(" > Error while creating insert"); logger.Info($" > Error: {shadowsInsertResult.Errors.AsMessages().ToStringBuilder()}"); return; } if (!illuminationInsertResult.Success) { logger.Info(" > Error while creating shapes with illuminations"); logger.Info($" > Error: {illuminationInsertResult.Errors.AsMessages().ToStringBuilder()}"); return; } if (!reflectionInsertResult.Success) { logger.Info(" > Error while creating shapes with reflection"); logger.Info($" > Error: {reflectionInsertResult.Errors.AsMessages().ToStringBuilder()}"); return; } if (!softEdgeInsertResult.Success) { logger.Info(" > Error while creating shapes with soft-edge"); logger.Info($" > Error: {softEdgeInsertResult.Errors.AsMessages().ToStringBuilder()}"); return; } #endregion #region Create output result var result = doc.CreateResult(new OutputResultConfig { AutoFitColumns = true }); if (!result.Success) { logger.Info(" > Error creating output result"); logger.Info($" > Error: {result.Errors.AsMessages().ToStringBuilder()}"); return; } #endregion #region Saves output result var saveResult = result.Result.Action(new SaveToFile { OutputPath = "~/Output/Sample10/Sample-10" }); if (!saveResult.Success) { logger.Info(" > Error while saving to disk"); logger.Info($" > Error: {saveResult.Errors.AsMessages().ToStringBuilder()}"); return; } logger.Info(" > Saved to disk correctly"); logger.Info(" > Path: ~/Output/Sample10/Sample-10.xlsx"); #endregion }
// Generates document public static void Generate(ILogger logger) { #region Creates cell styles var cellStylesTable = new Dictionary <string, XlsxCellStyle> { { "FieldHeader", new XlsxCellStyle { Font = { Name = "Calibri", Size = 11.0f, Bold = YesNo.Yes, }, Borders = { new XlsxStyleBorder { Show = YesNo.Yes, Position = KnownBorderPosition.Bottom, Color = "#9BC2E6" }, }, Content = { Color = "#DDEBF7" } } }, { "FieldValue", new XlsxCellStyle { Font = { Name = "Calibri", Size = 11.0f, }, Borders = { new XlsxStyleBorder { Show = YesNo.Yes, Position = KnownBorderPosition.Left, Color = "#9BC2E6" }, new XlsxStyleBorder { Show = YesNo.Yes, Position = KnownBorderPosition.Right, Color = "#9BC2E6" } }, Content = { Color = "#BDD7EE", AlternateColor = "#DDEBF7", DataType = new NumberDataType { Decimals = 1, Separator = YesNo.Yes }, Alignment = { Horizontal = KnownHorizontalAlignment.Right } } } }, { "PeriodValue", new XlsxCellStyle { Font = { Name = "Calibri", Size = 11.0f, Bold = YesNo.Yes, }, Content = { Color = "#BDD7EE", AlternateColor = "#DDEBF7", DataType = new DateTimeDataType { Locale = KnownCulture.Current, Format = KnownDateTimeFormat.ShortDatePattern } } } }, { "AggregateHeader", new XlsxCellStyle { Font = { Name = "Calibri", Size = 11.0f, Bold = YesNo.Yes, }, Borders = { new XlsxStyleBorder { Show = YesNo.Yes, Position = KnownBorderPosition.Top, Color = "#9BC2E6" }, new XlsxStyleBorder { Show = YesNo.Yes, Position = KnownBorderPosition.Left, Color = "#9BC2E6" }, new XlsxStyleBorder { Show = YesNo.Yes, Position = KnownBorderPosition.Right, Color = "#9BC2E6" } }, Content = { Color = "#DDEBF7", } } }, { "AggregateFieldValue", new XlsxCellStyle { Font = { Name = "Calibri", Size = 11.0f, Bold = YesNo.Yes, }, Borders = { new XlsxStyleBorder { Show = YesNo.Yes, Position = KnownBorderPosition.Top, Color = "#9BC2E6" }, new XlsxStyleBorder { Show = YesNo.Yes, Position = KnownBorderPosition.Left, Color = "#9BC2E6" }, new XlsxStyleBorder { Show = YesNo.Yes, Position = KnownBorderPosition.Right, Color = "#9BC2E6" } }, Content = { Color = "#DDEBF7", DataType = new NumberDataType { Decimals = 1, Separator = YesNo.Yes }, Alignment = { Horizontal = KnownHorizontalAlignment.Right } } } }, }; #endregion #region Creates xlsx file reference XlsxInput doc = XlsxInput.Create(new[] { "Stacked area chart", "Hoja2" }); #endregion #region Sheet 1 #region Sheet 1 > Insert Data #region PERIOD doc.Insert(new InsertText { Data = "Period", SheetName = "Stacked area chart", Style = cellStylesTable["FieldHeader"], Location = new XlsxPointRange { Column = 1, Row = 1 } }).Insert(new InsertText { Data = DateTime.Parse("01/01/2010"), SheetName = "Stacked area chart", Style = cellStylesTable["PeriodValue"], Location = new XlsxPointRange { Column = 1, Row = 2 } }).Insert(new InsertText { Data = DateTime.Parse("01/02/2010"), SheetName = "Stacked area chart", Style = cellStylesTable["PeriodValue"], Location = new XlsxPointRange { Column = 1, Row = 3 }, }).Insert(new InsertText { Data = DateTime.Parse("01/03/2010"), SheetName = "Stacked area chart", Style = cellStylesTable["PeriodValue"], Location = new XlsxPointRange { Column = 1, Row = 4 } }).Insert(new InsertText { Data = DateTime.Parse("01/04/2010"), SheetName = "Stacked area chart", Style = cellStylesTable["PeriodValue"], Location = new XlsxPointRange { Column = 1, Row = 5 } }).Insert(new InsertText { Data = DateTime.Parse("01/05/2010"), SheetName = "Stacked area chart", Style = cellStylesTable["PeriodValue"], Location = new XlsxPointRange { Column = 1, Row = 6 } }).Insert(new InsertText { Data = DateTime.Parse("01/06/2010"), SheetName = "Stacked area chart", Style = cellStylesTable["PeriodValue"], Location = new XlsxPointRange { Column = 1, Row = 7 } }).Insert(new InsertText { Data = DateTime.Parse("01/07/2010"), SheetName = "Stacked area chart", Style = cellStylesTable["PeriodValue"], Location = new XlsxPointRange { Column = 1, Row = 8 } }).Insert(new InsertText { Data = DateTime.Parse("01/08/2010"), SheetName = "Stacked area chart", Style = cellStylesTable["PeriodValue"], Location = new XlsxPointRange { Column = 1, Row = 9 } }).Insert(new InsertText { Data = DateTime.Parse("01/09/2010"), SheetName = "Stacked area chart", Style = cellStylesTable["PeriodValue"], Location = new XlsxPointRange { Column = 1, Row = 10 } }).Insert(new InsertText { Data = DateTime.Parse("01/10/2010"), SheetName = "Stacked area chart", Style = cellStylesTable["PeriodValue"], Location = new XlsxPointRange { Column = 1, Row = 11 } }).Insert(new InsertText { Data = DateTime.Parse("01/11/2010"), SheetName = "Stacked area chart", Style = cellStylesTable["PeriodValue"], Location = new XlsxPointRange { Column = 1, Row = 12 } }).Insert(new InsertText { Data = DateTime.Parse("01/12/2010"), SheetName = "Stacked area chart", Style = cellStylesTable["PeriodValue"], Location = new XlsxPointRange { Column = 1, Row = 13 } }).Insert(new InsertText { Data = "Total", SheetName = "Stacked area chart", Style = cellStylesTable["AggregateHeader"], Location = new XlsxPointRange { Column = 1, Row = 14 } }); #endregion #region Europe doc.Insert(new InsertText { Data = "Europe", SheetName = "Stacked area chart", Style = cellStylesTable["FieldHeader"], Location = new XlsxPointRange { Column = 2, Row = 1 } }).Insert(new InsertText { Data = 12.3, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 2, Row = 2 } }).Insert(new InsertText { Data = 13.9, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 2, Row = 3 }, }).Insert(new InsertText { Data = 11.4, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 2, Row = 4 } }).Insert(new InsertText { Data = 12.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 2, Row = 5 } }).Insert(new InsertText { Data = 9.4, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 2, Row = 6 } }).Insert(new InsertText { Data = 14.3, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 2, Row = 7 } }).Insert(new InsertText { Data = 7.3, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 2, Row = 8 } }).Insert(new InsertText { Data = 19.3, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 2, Row = 9 } }).Insert(new InsertText { Data = 21.0, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 2, Row = 10 } }).Insert(new InsertText { Data = 23.8, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 2, Row = 11 } }).Insert(new InsertText { Data = 25.6, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 2, Row = 12 } }).Insert(new InsertText { Data = 17.2, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 2, Row = 13 } }).Insert(new InsertAggregateFunction { SheetName = "Stacked area chart", Aggegate = { AggregateType = KnownAggregateType.Sum, HasAutoFilter = YesNo.Yes, Range = new XlsxRange { Start = { Column = 2, Row = 2 }, End = { Column = 2, Row = 13 } } }, Style = cellStylesTable["AggregateFieldValue"], Location = new XlsxPointRange { Column = 2, Row = 14 } }); #endregion #region Africa doc.Insert(new InsertText { Data = "Africa", SheetName = "Stacked area chart", Style = cellStylesTable["FieldHeader"], Location = new XlsxPointRange { Column = 3, Row = 1 } }).Insert(new InsertText { Data = 8.0, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 3, Row = 2 } }).Insert(new InsertText { Data = 9.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 3, Row = 3 }, }).Insert(new InsertText { Data = 8.7, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 3, Row = 4 } }).Insert(new InsertText { Data = 9.2, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 3, Row = 5 } }).Insert(new InsertText { Data = 10.0, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 3, Row = 6 } }).Insert(new InsertText { Data = 9.8, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 3, Row = 7 } }).Insert(new InsertText { Data = 11.0, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 3, Row = 8 } }).Insert(new InsertText { Data = 10.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 3, Row = 9 } }).Insert(new InsertText { Data = 8.5, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 3, Row = 10 } }).Insert(new InsertText { Data = 9.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 3, Row = 11 } }).Insert(new InsertText { Data = 10.8, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 3, Row = 12 } }).Insert(new InsertText { Data = 12.2, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 3, Row = 13 } }).Insert(new InsertAggregateFunction { SheetName = "Stacked area chart", Aggegate = { AggregateType = KnownAggregateType.Sum, HasAutoFilter = YesNo.Yes, Range = new XlsxRange { Start = { Column = 3, Row = 2 }, End = { Column = 3, Row = 13 } } }, Style = cellStylesTable["AggregateFieldValue"], Location = new XlsxPointRange { Column = 3, Row = 14 } }); #endregion #region Asia doc.Insert(new InsertText { Data = "Asia", SheetName = "Stacked area chart", Style = cellStylesTable["FieldHeader"], Location = new XlsxPointRange { Column = 4, Row = 1 } }).Insert(new InsertText { Data = 55.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 4, Row = 2 } }).Insert(new InsertText { Data = 51.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 4, Row = 3 }, }).Insert(new InsertText { Data = 54.7, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 4, Row = 4 } }).Insert(new InsertText { Data = 53.3, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 4, Row = 5 } }).Insert(new InsertText { Data = 45.3, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 4, Row = 6 } }).Insert(new InsertText { Data = 49.4, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 4, Row = 7 } }).Insert(new InsertText { Data = 50.0, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 4, Row = 8 } }).Insert(new InsertText { Data = 49.6, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 4, Row = 9 } }).Insert(new InsertText { Data = 41.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 4, Row = 10 } }).Insert(new InsertText { Data = 45.0, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 4, Row = 11 } }).Insert(new InsertText { Data = 49.0, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 4, Row = 12 } }).Insert(new InsertText { Data = 43.2, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 4, Row = 13 } }).Insert(new InsertAggregateFunction { SheetName = "Stacked area chart", Aggegate = { AggregateType = KnownAggregateType.Sum, HasAutoFilter = YesNo.Yes, Range = new XlsxRange { Start = { Column = 4, Row = 2 }, End = { Column = 4, Row = 13 } } }, Style = cellStylesTable["AggregateFieldValue"], Location = new XlsxPointRange { Column = 4, Row = 14 } }); #endregion #region North America doc.Insert(new InsertText { Data = "North America", SheetName = "Stacked area chart", Style = cellStylesTable["FieldHeader"], Location = new XlsxPointRange { Column = 5, Row = 1 } }).Insert(new InsertText { Data = 35.0, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 5, Row = 2 } }).Insert(new InsertText { Data = 35.3, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 5, Row = 3 }, }).Insert(new InsertText { Data = 32.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 5, Row = 4 } }).Insert(new InsertText { Data = 35.0, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 5, Row = 5 } }).Insert(new InsertText { Data = 25.8, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 5, Row = 6 } }).Insert(new InsertText { Data = 29.2, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 5, Row = 7 } }).Insert(new InsertText { Data = 31.2, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 5, Row = 8 } }).Insert(new InsertText { Data = 35.0, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 5, Row = 9 } }).Insert(new InsertText { Data = 35.0, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 5, Row = 10 } }).Insert(new InsertText { Data = 32.0, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 5, Row = 11 } }).Insert(new InsertText { Data = 33.6, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 5, Row = 12 } }).Insert(new InsertText { Data = 35.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 5, Row = 13 } }).Insert(new InsertAggregateFunction { SheetName = "Stacked area chart", Aggegate = { AggregateType = KnownAggregateType.Sum, HasAutoFilter = YesNo.Yes, Range = new XlsxRange { Start = { Column = 5, Row = 2 }, End = { Column = 5, Row = 13 } } }, Style = cellStylesTable["AggregateFieldValue"], Location = new XlsxPointRange { Column = 5, Row = 14 } }); #endregion #region South America doc.Insert(new InsertText { Data = "South America", SheetName = "Stacked area chart", Style = cellStylesTable["FieldHeader"], Location = new XlsxPointRange { Column = 6, Row = 1 } }).Insert(new InsertText { Data = 14.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 6, Row = 2 } }).Insert(new InsertText { Data = 14.4, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 6, Row = 3 }, }).Insert(new InsertText { Data = 13.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 6, Row = 4 } }).Insert(new InsertText { Data = 11.2, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 6, Row = 5 } }).Insert(new InsertText { Data = 12.4, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 6, Row = 6 } }).Insert(new InsertText { Data = 14.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 6, Row = 7 } }).Insert(new InsertText { Data = 14.9, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 6, Row = 8 } }).Insert(new InsertText { Data = 13.3, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 6, Row = 9 } }).Insert(new InsertText { Data = 14.5, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 6, Row = 10 } }).Insert(new InsertText { Data = 16.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 6, Row = 11 } }).Insert(new InsertText { Data = 14.4, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 6, Row = 12 } }).Insert(new InsertText { Data = 15.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 6, Row = 13 } }).Insert(new InsertAggregateFunction { SheetName = "Stacked area chart", Aggegate = { AggregateType = KnownAggregateType.Sum, HasAutoFilter = YesNo.Yes, Range = new XlsxRange { Start = { Column = 6, Row = 2 }, End = { Column = 6, Row = 13 } } }, Style = cellStylesTable["AggregateFieldValue"], Location = new XlsxPointRange { Column = 6, Row = 14 } }); #endregion #region Australia doc.Insert(new InsertText { Data = "Australia", SheetName = "Stacked area chart", Style = cellStylesTable["FieldHeader"], Location = new XlsxPointRange { Column = 7, Row = 1 } }).Insert(new InsertText { Data = 12.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 7, Row = 2 } }).Insert(new InsertText { Data = 11.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 7, Row = 3 }, }).Insert(new InsertText { Data = 12.3, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 7, Row = 4 } }).Insert(new InsertText { Data = 10.4, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 7, Row = 5 } }).Insert(new InsertText { Data = 13.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 7, Row = 6 } }).Insert(new InsertText { Data = 14.2, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 7, Row = 7 } }).Insert(new InsertText { Data = 12.3, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 7, Row = 8 } }).Insert(new InsertText { Data = 10.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 7, Row = 9 } }).Insert(new InsertText { Data = 9.3, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 7, Row = 10 } }).Insert(new InsertText { Data = 11.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 7, Row = 11 } }).Insert(new InsertText { Data = 13.4, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 7, Row = 12 } }).Insert(new InsertText { Data = 15.1, SheetName = "Stacked area chart", Style = cellStylesTable["FieldValue"], Location = new XlsxPointRange { Column = 7, Row = 13 } }).Insert(new InsertAggregateFunction { SheetName = "Stacked area chart", Aggegate = { AggregateType = KnownAggregateType.Sum, HasAutoFilter = YesNo.Yes, Range = new XlsxRange { Start = { Column = 7, Row = 2 }, End = { Column = 7, Row = 13 } } }, Style = cellStylesTable["AggregateFieldValue"], Location = new XlsxPointRange { Column = 7, Row = 14 } }); #endregion #endregion #region Sheet 1 > Insert Autofilter doc.Insert(new InsertAutoFilter { SheetName = "Stacked area chart", Location = new XlsxStringRange { Address = "A1:G1" } }); #endregion #region Sheet 1 > Insert Chart(s) var insertChartResult = doc.Insert(new InsertChart { SheetName = "Stacked area chart", Location = new XlsxPointRange { Column = 10, Row = 1 }, Chart = new XlsxChart { Name = "chart1", Size = { Width = 800, Height = 600 }, Axes = { Primary = { Values = { GridLines = GridLine.Major } } }, Legend = { Show = YesNo.Yes, Border = { Show = YesNo.Yes } }, Plots = { new XlsxChartPlot { Name = "plot1", Series = { new XlsxChartSerie { Name = "Europe", Color = "#285A8F", ChartType = ChartType.AreaStacked, AxisRange = new XlsxRange{ Start ={ Column = 1, Row = 2 }, End = { Column = 1, Row = 13 } }, FieldRange = new XlsxRange{ Start ={ Column = 2, Row = 2 }, End = { Column = 2, Row = 13 } } }, new XlsxChartSerie { Name = "AFRICA", Color = "#336EA9", ChartType = ChartType.AreaStacked, AxisRange = new XlsxRange{ Start ={ Column = 1, Row = 2 }, End = { Column = 1, Row = 13 } }, FieldRange = new XlsxRange{ Start ={ Column = 3, Row = 2 }, End = { Column = 3, Row = 13 } } }, new XlsxChartSerie { Name = "ASIA", Color = "#3572B1", ChartType = ChartType.AreaStacked, AxisRange = new XlsxRange{ Start ={ Column = 1, Row = 2 }, End = { Column = 1, Row = 13 } }, FieldRange = new XlsxRange{ Start ={ Column = 4, Row = 2 }, End = { Column = 4, Row = 13 } } }, new XlsxChartSerie { Name = "NORTHAMERICA", Color = "#628AC5", ChartType = ChartType.AreaStacked, AxisRange = new XlsxRange{ Start ={ Column = 1, Row = 2 }, End = { Column = 1, Row = 13 } }, FieldRange = new XlsxRange{ Start ={ Column = 5, Row = 2 }, End = { Column = 5, Row = 13 } } }, new XlsxChartSerie { Name = "SOUTHAMERICA", Color = "#93ADCD", ChartType = ChartType.AreaStacked, AxisRange = new XlsxRange{ Start ={ Column = 1, Row = 2 }, End = { Column = 1, Row = 13 } }, FieldRange = new XlsxRange{ Start ={ Column = 6, Row = 2 }, End = { Column = 6, Row = 13 } } }, new XlsxChartSerie { Name = "AUSTRALIA", Color = "#BCCCDE", ChartType = ChartType.AreaStacked, AxisRange = new XlsxRange{ Start ={ Column = 1, Row = 2 }, End = { Column = 1, Row = 13 } }, FieldRange = new XlsxRange{ Start ={ Column = 7, Row = 2 }, End = { Column = 7, Row = 13 } } } } } } } }); #endregion #endregion #region Evaluate insert(s) operation(s) if (!insertChartResult.Success) { logger.Info(" > Error while creating chart insert"); logger.Info($" > Error: {insertChartResult.Errors.AsMessages().ToStringBuilder()}"); return; } #endregion #region Create output result var result = doc.CreateResult(new OutputResultConfig { AutoFitColumns = true, GlobalSettings = XlsxSettings.Default }); if (!result.Success) { logger.Info(" > Error creating output result"); logger.Info($" > Error: {result.Errors.AsMessages().ToStringBuilder()}"); return; } #endregion #region Saves output result var saveResult = result.Result.Action(new SaveToFile { OutputPath = "~/Output/Sample14/Sample-14" }); if (!saveResult.Success) { logger.Info(" > Error while saving to disk"); logger.Info($" > Error: {saveResult.Errors.AsMessages().ToStringBuilder()}"); return; } logger.Info(" > Saved to disk correctly"); logger.Info(" > Path: ~/Output/Sample14/Sample-14.xlsx"); #endregion }