готовая вторая лаба
This commit is contained in:
parent
28ddf245dc
commit
95c4e2cb83
@ -1,6 +0,0 @@
|
||||
namespace KryukovLib
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
}
|
@ -9,9 +9,9 @@ namespace KryukovLib
|
||||
public class ColumnsConfiguratoin
|
||||
{
|
||||
public int ColumnsCount { get; set; }
|
||||
public string[] NameColumn { get; set; }
|
||||
public int[] Width { get; set; }
|
||||
public bool[] Visible { get; set; }
|
||||
public string[] PropertiesObject { get; set; }
|
||||
public string[]? NameColumn { get; set; }
|
||||
public int[]? Width { get; set; }
|
||||
public bool[]? Visible { get; set; }
|
||||
public string[]? PropertiesObject { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -79,20 +79,25 @@ namespace KryukovLib
|
||||
return val;
|
||||
}
|
||||
|
||||
public void AddItem<T>(T item, int RowIndex, int ColumnIndex)
|
||||
public void AddItem<T>(T item, int RowIndex) where T : class
|
||||
{
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
string propertyName = dataGridViewItems.Columns[ColumnIndex].DataPropertyName.ToString();
|
||||
string? value = item.GetType().GetProperty(propertyName)?.GetValue(item)?.ToString();
|
||||
var rowData = new object[dataGridViewItems.Columns.Count];
|
||||
|
||||
if (RowIndex >= dataGridViewItems.Rows.Count)
|
||||
for (int i = 0; i < dataGridViewItems.Columns.Count; i++)
|
||||
{
|
||||
dataGridViewItems.RowCount = RowIndex + 1;
|
||||
string propertyName = dataGridViewItems.Columns[i].DataPropertyName;
|
||||
PropertyInfo? propInfo = item.GetType().GetProperty(propertyName);
|
||||
|
||||
var value = propInfo?.GetValue(item);
|
||||
rowData[i] = value?.ToString() ?? string.Empty;
|
||||
}
|
||||
|
||||
dataGridViewItems.Rows[RowIndex].Cells[ColumnIndex].Value = value;
|
||||
dataGridViewItems.Rows.Add(rowData);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
4
COP/KryukovLib/CustomListBox.Designer.cs
generated
4
COP/KryukovLib/CustomListBox.Designer.cs
generated
@ -38,9 +38,9 @@ namespace KryukovLib
|
||||
listBoxCustom.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
listBoxCustom.FormattingEnabled = true;
|
||||
listBoxCustom.ItemHeight = 20;
|
||||
listBoxCustom.Location = new Point(0, 0);
|
||||
listBoxCustom.Location = new Point(0, 228);
|
||||
listBoxCustom.Name = "listBoxCustom";
|
||||
listBoxCustom.Size = new Size(245, 224);
|
||||
listBoxCustom.Size = new Size(245, 24);
|
||||
listBoxCustom.TabIndex = 0;
|
||||
//
|
||||
// CustomListBox
|
||||
|
36
COP/KryukovLib/ExcelGistogram.Designer.cs
generated
Normal file
36
COP/KryukovLib/ExcelGistogram.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
||||
namespace KryukovLib
|
||||
{
|
||||
partial class ExcelGistogram
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
35
COP/KryukovLib/ExcelGistogram.cs
Normal file
35
COP/KryukovLib/ExcelGistogram.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using KryukovLib.Helpers;
|
||||
using KryukovLib.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KryukovLib
|
||||
{
|
||||
public partial class ExcelGistogram : Component
|
||||
{
|
||||
public ExcelGistogram()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public ExcelGistogram(IContainer container)
|
||||
{
|
||||
container.Add(this);
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void CreateDoc(ChartConfig config)
|
||||
{
|
||||
config.CheckFields();
|
||||
IContext creator = new WorkWithExcel();
|
||||
creator.CreateHeader(config.Header);
|
||||
creator.CreateBarChart(config);
|
||||
creator.SaveDoc(config.FilePath);
|
||||
}
|
||||
}
|
||||
}
|
36
COP/KryukovLib/ExcelTable.Designer.cs
generated
Normal file
36
COP/KryukovLib/ExcelTable.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
||||
namespace KryukovLib
|
||||
{
|
||||
partial class ExcelTable
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
40
COP/KryukovLib/ExcelTable.cs
Normal file
40
COP/KryukovLib/ExcelTable.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using KryukovLib.Helpers;
|
||||
using KryukovLib.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KryukovLib
|
||||
{
|
||||
public partial class ExcelTable : Component
|
||||
{
|
||||
public ExcelTable()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public ExcelTable(IContainer container)
|
||||
{
|
||||
container.Add(this);
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void CreateDoc(TableConfig config)
|
||||
{
|
||||
config.CheckFields();
|
||||
IContext creator = new WorkWithExcel();
|
||||
creator.CreateHeader(config.Header);
|
||||
if (config.Data != null)
|
||||
foreach (var datum in config.Data)
|
||||
{
|
||||
creator.CreateTable(datum);
|
||||
}
|
||||
|
||||
creator.SaveDoc(config.FilePath);
|
||||
}
|
||||
}
|
||||
}
|
36
COP/KryukovLib/ExcelWithCustomTable.Designer.cs
generated
Normal file
36
COP/KryukovLib/ExcelWithCustomTable.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
||||
namespace KryukovLib
|
||||
{
|
||||
partial class ExcelWithCustomTable
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
61
COP/KryukovLib/ExcelWithCustomTable.cs
Normal file
61
COP/KryukovLib/ExcelWithCustomTable.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using KryukovLib.Helpers;
|
||||
using KryukovLib.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KryukovLib
|
||||
{
|
||||
public partial class ExcelWithCustomTable : Component
|
||||
{
|
||||
public ExcelWithCustomTable()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public ExcelWithCustomTable(IContainer container)
|
||||
{
|
||||
container.Add(this);
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void CreateDoc<T>(TableWithHeaderConfig<T> config)
|
||||
{
|
||||
config.CheckFields();
|
||||
config.ColumnsRowsDataCount = (config.ColumnsRowsWidth.Count, config.Data.Count + 1);
|
||||
IContext creator = new WorkWithExcel();
|
||||
creator.CreateHeader(config.Header);
|
||||
creator.CreateTableWithHeader();
|
||||
creator.CreateMultiHeader(config);
|
||||
var array = new string[config.Data.Count, config.Headers.Count];
|
||||
for (var j = 0; j < config.Data.Count; j++)
|
||||
{
|
||||
for (var i = 0; i < config.Headers.Count; i++)
|
||||
{
|
||||
(int, string, string) first = (0, null, null)!;
|
||||
foreach (var x in config.Headers.Where(x => x.ColumnIndex == i))
|
||||
{
|
||||
first = x;
|
||||
break;
|
||||
}
|
||||
|
||||
var (_, _, name) = first;
|
||||
if (name != null)
|
||||
{
|
||||
object? value = config.Data[j]?.GetType().GetProperty(name)!.GetValue(config.Data[j], null);
|
||||
array[j, i] = value == null
|
||||
? config.NullReplace
|
||||
: value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
creator.LoadDataToTableWithMultiHeader(array, config.ColumnsRowsWidth[1].Row);
|
||||
creator.SaveDoc(config.FilePath);
|
||||
}
|
||||
}
|
||||
}
|
453
COP/KryukovLib/Helpers/ChartGenerator.cs
Normal file
453
COP/KryukovLib/Helpers/ChartGenerator.cs
Normal file
@ -0,0 +1,453 @@
|
||||
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||
using DocumentFormat.OpenXml.Drawing;
|
||||
using DocumentFormat.OpenXml;
|
||||
using KryukovLib.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KryukovLib.Helpers
|
||||
{
|
||||
public class ChartGenerator
|
||||
{
|
||||
private static uint _order;
|
||||
|
||||
private static uint _index = 1u;
|
||||
|
||||
public static DocumentFormat.OpenXml.Drawing.Charts.Chart GenerateBarChart(ChartConfig config)
|
||||
{
|
||||
var axisId = new AxisId
|
||||
{
|
||||
Val = (UInt32Value)97045504u
|
||||
};
|
||||
var axisId2 = new AxisId
|
||||
{
|
||||
Val = (UInt32Value)97055488u
|
||||
};
|
||||
var barChart = new BarChart();
|
||||
barChart.Append(new BarDirection
|
||||
{
|
||||
Val = (EnumValue<BarDirectionValues>)BarDirectionValues.Column
|
||||
});
|
||||
barChart.Append(new BarGrouping
|
||||
{
|
||||
Val = (EnumValue<BarGroupingValues>)BarGroupingValues.Clustered
|
||||
});
|
||||
if (config.Data != null)
|
||||
barChart.Append(
|
||||
GenerateBarChartSeries(config.Data.First().Key, config.Data.First().Value));
|
||||
barChart.Append(axisId);
|
||||
barChart.Append(axisId2);
|
||||
var outline = new Outline
|
||||
{
|
||||
Width = (Int32Value)25400
|
||||
};
|
||||
outline.Append(new NoFill());
|
||||
var shapeProperties = new DocumentFormat.OpenXml.Drawing.Charts.ShapeProperties();
|
||||
shapeProperties.Append(new NoFill());
|
||||
shapeProperties.Append(outline);
|
||||
var plotArea = new PlotArea();
|
||||
plotArea.Append(new Layout());
|
||||
plotArea.Append(barChart);
|
||||
plotArea.Append(GenerateCategoryAxis(axisId, AxisPositionValues.Bottom, axisId2));
|
||||
plotArea.Append(GenerateValueAxis(axisId2, AxisPositionValues.Left, axisId));
|
||||
plotArea.Append(shapeProperties);
|
||||
return GenerateChart(config.ChartTitle, plotArea, config.LegendLocation);
|
||||
}
|
||||
|
||||
private static DocumentFormat.OpenXml.Drawing.Charts.Chart GenerateChart(
|
||||
string titleText,
|
||||
OpenXmlElement plotArea,
|
||||
Location legendLocation)
|
||||
{
|
||||
var chart = new DocumentFormat.OpenXml.Drawing.Charts.Chart();
|
||||
if (String.IsNullOrWhiteSpace(titleText))
|
||||
{
|
||||
chart.Append(GenerateTitle(titleText));
|
||||
}
|
||||
else
|
||||
{
|
||||
chart.Append(new AutoTitleDeleted
|
||||
{
|
||||
Val = (BooleanValue)true
|
||||
});
|
||||
}
|
||||
|
||||
var position = legendLocation switch
|
||||
{
|
||||
Location.Top => LegendPositionValues.Top,
|
||||
Location.Right => LegendPositionValues.Right,
|
||||
Location.Left => LegendPositionValues.Left,
|
||||
_ => LegendPositionValues.Bottom,
|
||||
};
|
||||
chart.Append(plotArea);
|
||||
chart.Append(GenerateLegend(position));
|
||||
chart.Append(new PlotVisibleOnly
|
||||
{
|
||||
Val = (BooleanValue)true
|
||||
});
|
||||
return chart;
|
||||
}
|
||||
|
||||
private static Title GenerateTitle(string titleText)
|
||||
{
|
||||
var run = new Run();
|
||||
run.Append(new RunProperties
|
||||
{
|
||||
FontSize = (Int32Value)1100
|
||||
});
|
||||
run.Append(new Text(titleText));
|
||||
var paragraphProperties = new ParagraphProperties();
|
||||
paragraphProperties.Append(new DefaultRunProperties
|
||||
{
|
||||
FontSize = (Int32Value)1100
|
||||
});
|
||||
var paragraph = new Paragraph();
|
||||
paragraph.Append(paragraphProperties);
|
||||
paragraph.Append(run);
|
||||
var richText = new RichText();
|
||||
richText.Append(new BodyProperties());
|
||||
richText.Append(new ListStyle());
|
||||
richText.Append(paragraph);
|
||||
var chartText = new ChartText();
|
||||
chartText.Append(richText);
|
||||
var title = new Title();
|
||||
title.Append(chartText);
|
||||
title.Append(new Layout());
|
||||
title.Append(new Overlay
|
||||
{
|
||||
Val = (BooleanValue)false
|
||||
});
|
||||
return title;
|
||||
}
|
||||
|
||||
private static BarChartSeries GenerateBarChartSeries(
|
||||
string seriesName,
|
||||
IReadOnlyCollection<(string Name, double Value)> data)
|
||||
{
|
||||
var barChartSeries = new BarChartSeries();
|
||||
barChartSeries.Append(new DocumentFormat.OpenXml.Drawing.Charts.Index
|
||||
{
|
||||
Val = (UInt32Value)_index
|
||||
});
|
||||
barChartSeries.Append(new Order
|
||||
{
|
||||
Val = (UInt32Value)_order
|
||||
});
|
||||
barChartSeries.Append(GenerateSeriesText(seriesName));
|
||||
barChartSeries.Append(GenerateCategoryAxisData(data.Select(c => c.Name).ToArray()));
|
||||
barChartSeries.Append(GenerateValues(data.Select(v => v.Value).ToArray()));
|
||||
_index++; _order++;
|
||||
return barChartSeries;
|
||||
}
|
||||
|
||||
private static SeriesText GenerateSeriesText(string seriesName)
|
||||
{
|
||||
var stringPoint = new StringPoint
|
||||
{
|
||||
Index = (UInt32Value)0u
|
||||
};
|
||||
stringPoint.Append(new NumericValue
|
||||
{
|
||||
Text = seriesName
|
||||
});
|
||||
var stringCache = new StringCache();
|
||||
stringCache.Append(new PointCount
|
||||
{
|
||||
Val = (UInt32Value)1u
|
||||
});
|
||||
stringCache.Append(stringPoint);
|
||||
var stringReference = new StringReference();
|
||||
stringReference.Append(stringCache);
|
||||
var seriesText = new SeriesText();
|
||||
seriesText.Append(stringReference);
|
||||
return seriesText;
|
||||
}
|
||||
|
||||
private static CategoryAxisData GenerateCategoryAxisData(IReadOnlyList<string> data)
|
||||
{
|
||||
var num = (uint)data.Count;
|
||||
var stringCache = GenerateStringCache(num);
|
||||
for (var num2 = 0u; num2 < num; num2++)
|
||||
{
|
||||
stringCache.Append(GenerateStringPoint(num2, data[(int)num2]));
|
||||
}
|
||||
|
||||
var stringReference = new StringReference();
|
||||
stringReference.Append(stringCache);
|
||||
var categoryAxisData = new CategoryAxisData();
|
||||
categoryAxisData.Append(stringReference);
|
||||
return categoryAxisData;
|
||||
}
|
||||
|
||||
private static Values GenerateValues(double[] data)
|
||||
{
|
||||
var num = (uint)data.Length;
|
||||
var numberingCache = GenerateNumberingCache(num);
|
||||
for (var num2 = 0u; num2 < num; num2++)
|
||||
{
|
||||
numberingCache.Append(GenerateNumericPoint(num2, data[num2]
|
||||
.ToString(CultureInfo.CurrentCulture)));
|
||||
}
|
||||
|
||||
var numberReference = new NumberReference();
|
||||
numberReference.Append(numberingCache);
|
||||
var values = new Values();
|
||||
values.Append(numberReference);
|
||||
return values;
|
||||
}
|
||||
|
||||
private static NumberingCache GenerateNumberingCache(uint numPoints)
|
||||
{
|
||||
var numberingCache = new NumberingCache();
|
||||
numberingCache.Append(new FormatCode
|
||||
{
|
||||
Text = "General"
|
||||
});
|
||||
numberingCache.Append(new PointCount
|
||||
{
|
||||
Val = (UInt32Value)numPoints
|
||||
});
|
||||
return numberingCache;
|
||||
}
|
||||
|
||||
private static StringCache GenerateStringCache(uint numPoints)
|
||||
{
|
||||
var stringCache = new StringCache();
|
||||
stringCache.Append(new PointCount
|
||||
{
|
||||
Val = (UInt32Value)numPoints
|
||||
});
|
||||
return stringCache;
|
||||
}
|
||||
|
||||
private static NumericPoint GenerateNumericPoint(UInt32Value idx, string text)
|
||||
{
|
||||
var numericPoint = new NumericPoint
|
||||
{
|
||||
Index = idx
|
||||
};
|
||||
numericPoint.Append(new NumericValue
|
||||
{
|
||||
Text = text
|
||||
});
|
||||
return numericPoint;
|
||||
}
|
||||
|
||||
private static StringPoint GenerateStringPoint(UInt32Value idx, string text)
|
||||
{
|
||||
var stringPoint = new StringPoint
|
||||
{
|
||||
Index = idx
|
||||
};
|
||||
stringPoint.Append(new NumericValue
|
||||
{
|
||||
Text = text
|
||||
});
|
||||
return stringPoint;
|
||||
}
|
||||
|
||||
private static CategoryAxis GenerateCategoryAxis(
|
||||
UnsignedIntegerType axisId,
|
||||
AxisPositionValues axisPosition,
|
||||
UnsignedIntegerType crossingAxisId)
|
||||
{
|
||||
var scaling = new Scaling();
|
||||
scaling.Append(new DocumentFormat.OpenXml.Drawing.Charts.Orientation
|
||||
{
|
||||
Val = (EnumValue<OrientationValues>)OrientationValues.MinMax
|
||||
});
|
||||
var solidFill = new SolidFill();
|
||||
solidFill.Append(new RgbColorModelHex
|
||||
{
|
||||
Val = (HexBinaryValue)"000000"
|
||||
});
|
||||
var defaultRunProperties = new DefaultRunProperties
|
||||
{
|
||||
FontSize = (Int32Value)1000,
|
||||
Bold = (BooleanValue)false,
|
||||
Italic = (BooleanValue)false,
|
||||
Underline = (EnumValue<TextUnderlineValues>)TextUnderlineValues.None,
|
||||
Strike = (EnumValue<TextStrikeValues>)TextStrikeValues.NoStrike,
|
||||
Baseline = (Int32Value)0
|
||||
};
|
||||
defaultRunProperties.Append(solidFill);
|
||||
var paragraphProperties = new ParagraphProperties();
|
||||
paragraphProperties.Append(defaultRunProperties);
|
||||
var paragraph = new Paragraph();
|
||||
paragraph.Append(paragraphProperties);
|
||||
paragraph.Append(new EndParagraphRunProperties());
|
||||
var textProperties = new TextProperties();
|
||||
textProperties.Append(new BodyProperties
|
||||
{
|
||||
Rotation = (Int32Value)(-1800000),
|
||||
Vertical = (EnumValue<TextVerticalValues>)TextVerticalValues.Horizontal
|
||||
});
|
||||
textProperties.Append(new ListStyle());
|
||||
textProperties.Append(paragraph);
|
||||
var categoryAxis = new CategoryAxis();
|
||||
categoryAxis.Append(new AxisId
|
||||
{
|
||||
Val = axisId.Val
|
||||
});
|
||||
categoryAxis.Append(scaling);
|
||||
categoryAxis.Append(new AxisPosition
|
||||
{
|
||||
Val = (EnumValue<AxisPositionValues>)axisPosition
|
||||
});
|
||||
categoryAxis.Append(new NumberingFormat
|
||||
{
|
||||
FormatCode = (StringValue)"General",
|
||||
SourceLinked = (BooleanValue)true
|
||||
});
|
||||
categoryAxis.Append(new TickLabelPosition
|
||||
{
|
||||
Val = (EnumValue<TickLabelPositionValues>)TickLabelPositionValues.Low
|
||||
});
|
||||
categoryAxis.Append(GenerateChartShapeProperties(3175));
|
||||
categoryAxis.Append(textProperties);
|
||||
categoryAxis.Append(new CrossingAxis
|
||||
{
|
||||
Val = crossingAxisId.Val
|
||||
});
|
||||
categoryAxis.Append(new Crosses
|
||||
{
|
||||
Val = (EnumValue<CrossesValues>)CrossesValues.AutoZero
|
||||
});
|
||||
categoryAxis.Append(new AutoLabeled
|
||||
{
|
||||
Val = (BooleanValue)true
|
||||
});
|
||||
categoryAxis.Append(new LabelAlignment
|
||||
{
|
||||
Val = (EnumValue<LabelAlignmentValues>)LabelAlignmentValues.Center
|
||||
});
|
||||
categoryAxis.Append(new LabelOffset
|
||||
{
|
||||
Val = (UInt16Value)(ushort)100
|
||||
});
|
||||
categoryAxis.Append(new TickLabelSkip
|
||||
{
|
||||
Val = (Int32Value)1
|
||||
});
|
||||
categoryAxis.Append(new TickMarkSkip
|
||||
{
|
||||
Val = (Int32Value)1
|
||||
});
|
||||
return categoryAxis;
|
||||
}
|
||||
|
||||
private static ValueAxis GenerateValueAxis(
|
||||
UnsignedIntegerType axisId,
|
||||
AxisPositionValues position,
|
||||
UnsignedIntegerType crossingAxisId)
|
||||
{
|
||||
var scaling = new Scaling();
|
||||
scaling.Append(new DocumentFormat.OpenXml.Drawing.Charts.Orientation
|
||||
{
|
||||
Val = (EnumValue<OrientationValues>)OrientationValues.MinMax
|
||||
});
|
||||
var paragraphProperties = new ParagraphProperties();
|
||||
paragraphProperties.Append(new DefaultRunProperties());
|
||||
var paragraph = new Paragraph();
|
||||
paragraph.Append(paragraphProperties);
|
||||
paragraph.Append(new EndParagraphRunProperties());
|
||||
var textProperties = new TextProperties();
|
||||
textProperties.Append(new BodyProperties());
|
||||
textProperties.Append(new ListStyle());
|
||||
textProperties.Append(paragraph);
|
||||
var valueAxis = new ValueAxis();
|
||||
valueAxis.Append(new AxisId
|
||||
{
|
||||
Val = axisId.Val
|
||||
});
|
||||
valueAxis.Append(scaling);
|
||||
valueAxis.Append(new Delete
|
||||
{
|
||||
Val = (BooleanValue)false
|
||||
});
|
||||
valueAxis.Append(new AxisPosition
|
||||
{
|
||||
Val = (EnumValue<AxisPositionValues>)position
|
||||
});
|
||||
valueAxis.Append(new MajorGridlines());
|
||||
valueAxis.Append(new NumberingFormat
|
||||
{
|
||||
FormatCode = (StringValue)"General",
|
||||
SourceLinked = (BooleanValue)false
|
||||
});
|
||||
valueAxis.Append(new MajorTickMark
|
||||
{
|
||||
Val = (EnumValue<TickMarkValues>)TickMarkValues.None
|
||||
});
|
||||
valueAxis.Append(new TickLabelPosition
|
||||
{
|
||||
Val = (EnumValue<TickLabelPositionValues>)TickLabelPositionValues.NextTo
|
||||
});
|
||||
valueAxis.Append(GenerateChartShapeProperties(9525));
|
||||
valueAxis.Append(textProperties);
|
||||
valueAxis.Append(new CrossingAxis
|
||||
{
|
||||
Val = crossingAxisId.Val
|
||||
});
|
||||
valueAxis.Append(new Crosses
|
||||
{
|
||||
Val = (EnumValue<CrossesValues>)CrossesValues.AutoZero
|
||||
});
|
||||
valueAxis.Append(new CrossBetween
|
||||
{
|
||||
Val = (EnumValue<CrossBetweenValues>)CrossBetweenValues.Between
|
||||
});
|
||||
return valueAxis;
|
||||
}
|
||||
|
||||
private static ChartShapeProperties GenerateChartShapeProperties(int width)
|
||||
{
|
||||
var solidFill = new SolidFill();
|
||||
solidFill.Append(new RgbColorModelHex
|
||||
{
|
||||
Val = (HexBinaryValue)"000000"
|
||||
});
|
||||
var outline = new Outline
|
||||
{
|
||||
Width = (Int32Value)width
|
||||
};
|
||||
outline.Append(solidFill);
|
||||
outline.Append(new PresetDash
|
||||
{
|
||||
Val = (EnumValue<PresetLineDashValues>)PresetLineDashValues.Solid
|
||||
});
|
||||
var chartShapeProperties = new ChartShapeProperties();
|
||||
chartShapeProperties.Append(outline);
|
||||
return chartShapeProperties;
|
||||
}
|
||||
|
||||
private static Legend GenerateLegend(LegendPositionValues position)
|
||||
{
|
||||
var paragraphProperties = new ParagraphProperties();
|
||||
paragraphProperties.Append(new DefaultRunProperties());
|
||||
var paragraph = new Paragraph();
|
||||
paragraph.Append(paragraphProperties);
|
||||
paragraph.Append(new EndParagraphRunProperties());
|
||||
var textProperties = new TextProperties();
|
||||
textProperties.Append(new BodyProperties());
|
||||
textProperties.Append(new ListStyle());
|
||||
textProperties.Append(paragraph);
|
||||
var legend = new Legend();
|
||||
legend.Append(new LegendPosition
|
||||
{
|
||||
Val = (EnumValue<LegendPositionValues>)position
|
||||
});
|
||||
legend.Append(new Layout());
|
||||
legend.Append(new Overlay
|
||||
{
|
||||
Val = (BooleanValue)false
|
||||
});
|
||||
legend.Append(textProperties);
|
||||
return legend;
|
||||
}
|
||||
}
|
||||
}
|
17
COP/KryukovLib/Helpers/IContext.cs
Normal file
17
COP/KryukovLib/Helpers/IContext.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using KryukovLib.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KryukovLib.Helpers
|
||||
{
|
||||
public interface IContext : ICreator
|
||||
{
|
||||
void CreateTable(string[,] data);
|
||||
void CreateTableWithHeader();
|
||||
void CreateMultiHeader<T>(TableWithHeaderConfig<T> config);
|
||||
void LoadDataToTableWithMultiHeader(string[,] data, int rowHeigth);
|
||||
}
|
||||
}
|
16
COP/KryukovLib/Helpers/ICreator.cs
Normal file
16
COP/KryukovLib/Helpers/ICreator.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using KryukovLib.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KryukovLib.Helpers
|
||||
{
|
||||
public interface ICreator
|
||||
{
|
||||
void CreateHeader(string header);
|
||||
void SaveDoc(string filepath);
|
||||
void CreateBarChart(ChartConfig config);
|
||||
}
|
||||
}
|
406
COP/KryukovLib/Helpers/WorkWithExcel.cs
Normal file
406
COP/KryukovLib/Helpers/WorkWithExcel.cs
Normal file
@ -0,0 +1,406 @@
|
||||
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
|
||||
using DocumentFormat.OpenXml.Drawing;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using KryukovLib.Models;
|
||||
|
||||
namespace KryukovLib.Helpers
|
||||
{
|
||||
public class WorkWithExcel : IContext
|
||||
{
|
||||
|
||||
private uint _index;
|
||||
private SheetData? _sheetData;
|
||||
private uint _startRowIndex;
|
||||
private Columns? _columns;
|
||||
private DocumentFormat.OpenXml.Drawing.Charts.Chart? _chart;
|
||||
|
||||
private SheetData SheetData => _sheetData ??= new SheetData();
|
||||
private Columns Columns => _columns ??= new Columns();
|
||||
|
||||
public void CreateBarChart(ChartConfig config)
|
||||
{
|
||||
_chart = ChartGenerator.GenerateBarChart(config);
|
||||
}
|
||||
public void CreateMultiHeader<T>(TableWithHeaderConfig<T> config)
|
||||
{
|
||||
var counter = 1u;
|
||||
var num = 2;
|
||||
if (config.ColumnsRowsWidth != null)
|
||||
{
|
||||
foreach (var item in config.ColumnsRowsWidth.Where(x => x.Column > 0))
|
||||
{
|
||||
Columns.Append(new Column
|
||||
{
|
||||
Min = (UInt32Value)counter,
|
||||
Max = (UInt32Value)counter,
|
||||
Width = (DoubleValue)(item.Column * num),
|
||||
CustomWidth = (BooleanValue)true
|
||||
});
|
||||
counter++;
|
||||
}
|
||||
|
||||
counter = _startRowIndex;
|
||||
num = 5;
|
||||
if ((from r in SheetData.Elements<Row>()
|
||||
where (uint)r.RowIndex == counter
|
||||
select r).Any())
|
||||
{
|
||||
var row = (from r in SheetData.Elements<Row>()
|
||||
where (uint)r.RowIndex == counter
|
||||
select r).First();
|
||||
row.Height = (DoubleValue)(config.ColumnsRowsWidth[0].Row * num);
|
||||
row.CustomHeight = (BooleanValue)true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SheetData.Append(new Row
|
||||
{
|
||||
RowIndex = (UInt32Value)counter,
|
||||
Height = (DoubleValue)(config.ColumnsRowsWidth[0].Row * num),
|
||||
CustomHeight = (BooleanValue)true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const uint styleIndex = 2u;
|
||||
if (config.Headers == null) return;
|
||||
{
|
||||
var num3 = config.Headers.Count(x => x.ColumnIndex > 0);
|
||||
CreateCell(0, _startRowIndex, config.Headers.FirstOrDefault<(int, string, string)>(((int ColumnIndex, string Header, string PropertyName) x) => x is { ColumnIndex: 0, }).Item3, styleIndex);
|
||||
for (var i = 0; i < num3; i++)
|
||||
{
|
||||
CreateCell(i + 1, _startRowIndex, config.Headers.FirstOrDefault<(int, string, string)>(((int ColumnIndex, string Header, string PropertyName) x) => x.ColumnIndex == i + 1 ).Item3, styleIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void GenerateStyle(OpenXmlPartContainer workbookPart)
|
||||
{
|
||||
var workbookStylesPart = workbookPart.AddNewPart<WorkbookStylesPart>();
|
||||
workbookStylesPart.Stylesheet = new Stylesheet();
|
||||
var fonts = new DocumentFormat.OpenXml.Spreadsheet.Fonts
|
||||
{
|
||||
Count = (UInt32Value)2u,
|
||||
KnownFonts = BooleanValue.FromBoolean(value: true)
|
||||
};
|
||||
fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font
|
||||
{
|
||||
FontSize = new FontSize
|
||||
{
|
||||
Val = (DoubleValue)11.0
|
||||
},
|
||||
FontName = new FontName
|
||||
{
|
||||
Val = (StringValue)"Calibri"
|
||||
},
|
||||
FontFamilyNumbering = new FontFamilyNumbering
|
||||
{
|
||||
Val = (Int32Value)2
|
||||
},
|
||||
FontScheme = new DocumentFormat.OpenXml.Spreadsheet.FontScheme
|
||||
{
|
||||
Val = new EnumValue<FontSchemeValues>(FontSchemeValues.Minor)
|
||||
}
|
||||
});
|
||||
fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font
|
||||
{
|
||||
FontSize = new FontSize
|
||||
{
|
||||
Val = (DoubleValue)11.0
|
||||
},
|
||||
FontName = new FontName
|
||||
{
|
||||
Val = (StringValue)"Calibri"
|
||||
},
|
||||
FontFamilyNumbering = new FontFamilyNumbering
|
||||
{
|
||||
Val = (Int32Value)2
|
||||
},
|
||||
FontScheme = new DocumentFormat.OpenXml.Spreadsheet.FontScheme
|
||||
{
|
||||
Val = new EnumValue<FontSchemeValues>(FontSchemeValues.Minor)
|
||||
},
|
||||
Bold = new Bold()
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(fonts);
|
||||
var fills = new Fills
|
||||
{
|
||||
Count = (UInt32Value)1u
|
||||
};
|
||||
fills.Append(new DocumentFormat.OpenXml.Spreadsheet.Fill
|
||||
{
|
||||
PatternFill = new DocumentFormat.OpenXml.Spreadsheet.PatternFill
|
||||
{
|
||||
PatternType = new EnumValue<PatternValues>(PatternValues.None)
|
||||
}
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(fills);
|
||||
var borders = new Borders
|
||||
{
|
||||
Count = (UInt32Value)2u
|
||||
};
|
||||
borders.Append(new Border
|
||||
{
|
||||
LeftBorder = new DocumentFormat.OpenXml.Spreadsheet.LeftBorder(),
|
||||
RightBorder = new DocumentFormat.OpenXml.Spreadsheet.RightBorder(),
|
||||
TopBorder = new DocumentFormat.OpenXml.Spreadsheet.TopBorder(),
|
||||
BottomBorder = new DocumentFormat.OpenXml.Spreadsheet.BottomBorder(),
|
||||
DiagonalBorder = new DiagonalBorder()
|
||||
});
|
||||
borders.Append(new Border
|
||||
{
|
||||
LeftBorder = new DocumentFormat.OpenXml.Spreadsheet.LeftBorder
|
||||
{
|
||||
Style = (EnumValue<BorderStyleValues>)BorderStyleValues.Thin
|
||||
},
|
||||
RightBorder = new DocumentFormat.OpenXml.Spreadsheet.RightBorder
|
||||
{
|
||||
Style = (EnumValue<BorderStyleValues>)BorderStyleValues.Thin
|
||||
},
|
||||
TopBorder = new DocumentFormat.OpenXml.Spreadsheet.TopBorder
|
||||
{
|
||||
Style = (EnumValue<BorderStyleValues>)BorderStyleValues.Thin
|
||||
},
|
||||
BottomBorder = new DocumentFormat.OpenXml.Spreadsheet.BottomBorder
|
||||
{
|
||||
Style = (EnumValue<BorderStyleValues>)BorderStyleValues.Thin
|
||||
}
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(borders);
|
||||
var cellFormats = new CellFormats
|
||||
{
|
||||
Count = (UInt32Value)3u
|
||||
};
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = (UInt32Value)0u,
|
||||
FormatId = (UInt32Value)0u,
|
||||
FontId = (UInt32Value)0u,
|
||||
BorderId = (UInt32Value)0u,
|
||||
FillId = (UInt32Value)0u
|
||||
});
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = (UInt32Value)0u,
|
||||
FormatId = (UInt32Value)0u,
|
||||
FontId = (UInt32Value)0u,
|
||||
BorderId = (UInt32Value)1u,
|
||||
FillId = (UInt32Value)0u
|
||||
});
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = (UInt32Value)0u,
|
||||
FormatId = (UInt32Value)0u,
|
||||
FontId = (UInt32Value)1u,
|
||||
BorderId = (UInt32Value)1u,
|
||||
FillId = (UInt32Value)0u,
|
||||
Alignment = new Alignment
|
||||
{
|
||||
Horizontal = (EnumValue<HorizontalAlignmentValues>)HorizontalAlignmentValues.Center,
|
||||
Vertical = (EnumValue<VerticalAlignmentValues>)VerticalAlignmentValues.Center,
|
||||
WrapText = (BooleanValue)true
|
||||
}
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(cellFormats);
|
||||
}
|
||||
public void CreateHeader(string header)
|
||||
{
|
||||
_index = 1u;
|
||||
var cell = CreateCell("A", _index);
|
||||
var run = new DocumentFormat.OpenXml.Spreadsheet.Run();
|
||||
run.Append(new DocumentFormat.OpenXml.Spreadsheet.Text(header));
|
||||
run.RunProperties = new DocumentFormat.OpenXml.Spreadsheet.RunProperties(new Bold());
|
||||
var inlineString = new InlineString();
|
||||
inlineString.Append(run);
|
||||
cell.Append(inlineString);
|
||||
cell.DataType = (EnumValue<CellValues>)CellValues.InlineString;
|
||||
_index++;
|
||||
}
|
||||
public void CreateTable(string[,] data)
|
||||
{
|
||||
for (var i = 0; i < data.GetLength(0); i++)
|
||||
for (var j = 0; j < data.GetLength(1); j++)
|
||||
CreateCell(j, (uint)(i + _index), data[i, j], 2u);
|
||||
|
||||
_index += (uint)data.GetLength(0);
|
||||
}
|
||||
private Cell CreateCell(string columnName, uint rowIndex)
|
||||
{
|
||||
var columnName2 = columnName;
|
||||
var text = columnName2 + rowIndex;
|
||||
Row row;
|
||||
if ((from r in SheetData.Elements<Row>()
|
||||
where (uint)r.RowIndex == rowIndex
|
||||
select r).Any())
|
||||
{
|
||||
row = (from r in SheetData.Elements<Row>()
|
||||
where (uint)r.RowIndex == rowIndex
|
||||
select r).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
row = new Row
|
||||
{
|
||||
RowIndex = (UInt32Value)rowIndex
|
||||
};
|
||||
SheetData.Append(row);
|
||||
}
|
||||
|
||||
var cell = row.Elements<Cell>().FirstOrDefault(c => c.CellReference!.Value == columnName2 + rowIndex);
|
||||
if (cell != null) return cell;
|
||||
var referenceChild = row.Elements<Cell>()
|
||||
.FirstOrDefault(
|
||||
item => item.CellReference!.Value!.Length == text.Length &&
|
||||
string.Compare(item.CellReference!.Value, text, StringComparison.OrdinalIgnoreCase) > 0);
|
||||
|
||||
cell = new Cell
|
||||
{
|
||||
CellReference = (StringValue)text
|
||||
};
|
||||
row.InsertBefore(cell, referenceChild);
|
||||
|
||||
return cell;
|
||||
}
|
||||
private static string GetExcelColumnName(int columnNumber)
|
||||
{
|
||||
columnNumber++;
|
||||
var num = columnNumber;
|
||||
var text = string.Empty;
|
||||
while (num > 0)
|
||||
{
|
||||
var num2 = (num - 1) % 26;
|
||||
text = Convert.ToChar(65 + num2) + text;
|
||||
num = (num - num2) / 26;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
private void CreateCell(int columnIndex, uint rowIndex, string text, uint styleIndex)
|
||||
{
|
||||
var cell = CreateCell(GetExcelColumnName(columnIndex), rowIndex);
|
||||
cell.CellValue = new CellValue(text);
|
||||
cell.DataType = (EnumValue<CellValues>)CellValues.String;
|
||||
cell.StyleIndex = (UInt32Value)styleIndex;
|
||||
}
|
||||
public void SaveDoc(string filepath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filepath))
|
||||
{
|
||||
throw new ArgumentNullException("File name is empty");
|
||||
}
|
||||
|
||||
if (SheetData == null)
|
||||
{
|
||||
throw new ArgumentNullException("Dock body is empty! Nothing to save!");
|
||||
}
|
||||
|
||||
using var spreadsheetDocument = SpreadsheetDocument.Create(filepath, SpreadsheetDocumentType.Workbook);
|
||||
var workbookPart = spreadsheetDocument.AddWorkbookPart();
|
||||
GenerateStyle(workbookPart);
|
||||
workbookPart.Workbook = new Workbook();
|
||||
var worksheetPart = workbookPart.AddNewPart<WorksheetPart>();
|
||||
worksheetPart.Worksheet = new Worksheet();
|
||||
if (_columns != null)
|
||||
{
|
||||
worksheetPart.Worksheet.Append(_columns);
|
||||
}
|
||||
|
||||
worksheetPart.Worksheet.Append(SheetData);
|
||||
var sheets = spreadsheetDocument.WorkbookPart!.Workbook.AppendChild(new Sheets());
|
||||
var sheet = new Sheet
|
||||
{
|
||||
Id = (StringValue)spreadsheetDocument.WorkbookPart!.GetIdOfPart(worksheetPart),
|
||||
SheetId = (UInt32Value)1u,
|
||||
Name = (StringValue)"List 1"
|
||||
};
|
||||
sheets.Append(sheet);
|
||||
if (_chart == null) return;
|
||||
var drawingsPart = worksheetPart.AddNewPart<DrawingsPart>();
|
||||
worksheetPart.Worksheet.Append(new Drawing
|
||||
{
|
||||
Id = (StringValue)worksheetPart.GetIdOfPart(drawingsPart)
|
||||
});
|
||||
worksheetPart.Worksheet.Save();
|
||||
var chartPart = drawingsPart.AddNewPart<ChartPart>();
|
||||
chartPart.ChartSpace = new ChartSpace();
|
||||
chartPart.ChartSpace.Append(new EditingLanguage
|
||||
{
|
||||
Val = new StringValue("en-US")
|
||||
});
|
||||
chartPart.ChartSpace.Append(_chart);
|
||||
chartPart.ChartSpace.Save();
|
||||
drawingsPart.WorksheetDrawing = new WorksheetDrawing();
|
||||
var twoCellAnchor = drawingsPart.WorksheetDrawing.AppendChild(new TwoCellAnchor());
|
||||
twoCellAnchor.Append(new DocumentFormat.OpenXml.Drawing.Spreadsheet.FromMarker(new ColumnId("2"), new ColumnOffset("581025"), new RowId("2"), new RowOffset("114300")));
|
||||
twoCellAnchor.Append(new DocumentFormat.OpenXml.Drawing.Spreadsheet.ToMarker(new ColumnId("17"), new ColumnOffset("276225"), new RowId("32"), new RowOffset("0")));
|
||||
var graphicFrame = twoCellAnchor.AppendChild(new DocumentFormat.OpenXml.Drawing.Spreadsheet.GraphicFrame());
|
||||
graphicFrame.Macro = (StringValue)"";
|
||||
graphicFrame.Append(new DocumentFormat.OpenXml.Drawing.Spreadsheet.NonVisualGraphicFrameProperties(new DocumentFormat.OpenXml.Drawing.Spreadsheet.NonVisualDrawingProperties
|
||||
{
|
||||
Id = new UInt32Value(2u),
|
||||
Name = (StringValue)"Chart 1"
|
||||
}, new DocumentFormat.OpenXml.Drawing.Spreadsheet.NonVisualGraphicFrameDrawingProperties()));
|
||||
graphicFrame.Append(new Transform(new Offset
|
||||
{
|
||||
X = (Int64Value)0L,
|
||||
Y = (Int64Value)0L
|
||||
}, new Extents
|
||||
{
|
||||
Cx = (Int64Value)0L,
|
||||
Cy = (Int64Value)0L
|
||||
}));
|
||||
graphicFrame.Append(new Graphic(new GraphicData(new ChartReference
|
||||
{
|
||||
Id = (StringValue)drawingsPart.GetIdOfPart(chartPart)
|
||||
})
|
||||
{
|
||||
Uri = (StringValue)"http://schemas.openxmlformats.org/drawingml/2006/chart"
|
||||
}));
|
||||
twoCellAnchor.Append(new ClientData());
|
||||
drawingsPart.WorksheetDrawing.Save();
|
||||
}
|
||||
public void CreateTableWithHeader()
|
||||
{
|
||||
_startRowIndex = _index;
|
||||
}
|
||||
public void LoadDataToTableWithMultiHeader(string[,] data, int rowHeight)
|
||||
{
|
||||
const int num = 5;
|
||||
for (var i = 0u; i < data.GetLength(0); i++)
|
||||
{
|
||||
if ((from r in SheetData.Elements<Row>()
|
||||
where (uint)r.RowIndex == i + 1
|
||||
select r).Any())
|
||||
{
|
||||
var row = (from r in SheetData.Elements<Row>()
|
||||
where (uint)r.RowIndex == i + 1
|
||||
select r).First();
|
||||
row.Height = (DoubleValue)(rowHeight * num);
|
||||
row.CustomHeight = (BooleanValue)true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SheetData.Append(new Row
|
||||
{
|
||||
RowIndex = (UInt32Value)(i + 1),
|
||||
Height = (DoubleValue)(rowHeight * num),
|
||||
CustomHeight = (BooleanValue)true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_startRowIndex++;
|
||||
for (var j = 0; j < data.GetLength(0); j++)
|
||||
{
|
||||
for (var k = 0; k < data.GetLength(1); k++)
|
||||
{
|
||||
CreateCell(k, _startRowIndex, data[j, k], k == 0 ? 2u : 1u);
|
||||
}
|
||||
|
||||
_startRowIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,4 +7,8 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DocumentFormat.OpenXml" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
21
COP/KryukovLib/Models/ChartConfig.cs
Normal file
21
COP/KryukovLib/Models/ChartConfig.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KryukovLib.Models
|
||||
{
|
||||
public class ChartConfig : DocumentConfig
|
||||
{
|
||||
public string ChartTitle { get; init; } = string.Empty;
|
||||
public Location LegendLocation { get; init; }
|
||||
public Dictionary<string, List<(string Name, double Value)>>? Data { get; init; }
|
||||
|
||||
public void CheckFields()
|
||||
{
|
||||
if (Data == null || Data.Count == 0)
|
||||
throw new ArgumentNullException("Data count is null");
|
||||
}
|
||||
}
|
||||
}
|
14
COP/KryukovLib/Models/DocumentConfig.cs
Normal file
14
COP/KryukovLib/Models/DocumentConfig.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KryukovLib.Models
|
||||
{
|
||||
public class DocumentConfig
|
||||
{
|
||||
public string FilePath { get; init; } = string.Empty;
|
||||
public string Header { get; init; } = string.Empty;
|
||||
}
|
||||
}
|
13
COP/KryukovLib/Models/Location.cs
Normal file
13
COP/KryukovLib/Models/Location.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KryukovLib.Models
|
||||
{
|
||||
public enum Location
|
||||
{
|
||||
Left, Right, Top, Bottom
|
||||
}
|
||||
}
|
19
COP/KryukovLib/Models/TableConfig.cs
Normal file
19
COP/KryukovLib/Models/TableConfig.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KryukovLib.Models
|
||||
{
|
||||
public class TableConfig : DocumentConfig
|
||||
{
|
||||
public List<string[,]>? Data { get; init; }
|
||||
|
||||
public void CheckFields()
|
||||
{
|
||||
if (Data == null || Data.Count == 0 || Data.All(x => x.Length == 0))
|
||||
throw new ArgumentNullException("Data is null");
|
||||
}
|
||||
}
|
||||
}
|
27
COP/KryukovLib/Models/TableWithHeaderConfig.cs
Normal file
27
COP/KryukovLib/Models/TableWithHeaderConfig.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KryukovLib.Models
|
||||
{
|
||||
public class TableWithHeaderConfig<T> : DocumentConfig
|
||||
{
|
||||
|
||||
public (int Columns, int Rows) ColumnsRowsDataCount { get; set; }
|
||||
public List<(int Column, int Row)>? ColumnsRowsWidth { get; init; }
|
||||
public List<(int ColumnIndex, string Header, string PropertyName)>? Headers { get; init; }
|
||||
public List<T>? Data { get; init; }
|
||||
|
||||
public void CheckFields()
|
||||
{
|
||||
if (Data == null || Data.Count == 0)
|
||||
throw new ArgumentNullException("No data");
|
||||
if (ColumnsRowsWidth is null || ColumnsRowsWidth.Count == 0)
|
||||
throw new ArgumentNullException("Rows width invalid");
|
||||
if (Headers is null || Headers.Count == 0)
|
||||
throw new ArgumentNullException("Header data invalid");
|
||||
}
|
||||
}
|
||||
}
|
83
COP/Test/Form1.Designer.cs
generated
83
COP/Test/Form1.Designer.cs
generated
@ -28,6 +28,7 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
customDataGridView1 = new KryukovLib.CustomDataGridView();
|
||||
customListBox1 = new KryukovLib.CustomListBox();
|
||||
dateBoxWithNull1 = new KryukovLib.DateBoxWithNull();
|
||||
@ -38,14 +39,21 @@
|
||||
buttonGetValue = new Button();
|
||||
buttonGetValueCheckBox = new Button();
|
||||
buttonSetValueCheckBox = new Button();
|
||||
textBoxEvent = new TextBox();
|
||||
buttonExcel = new Button();
|
||||
excelSaveHeader = new Button();
|
||||
SaveBar = new Button();
|
||||
excelTable1 = new KryukovLib.ExcelTable(components);
|
||||
excelGistogram1 = new KryukovLib.ExcelGistogram(components);
|
||||
excelWithCustomTable1 = new KryukovLib.ExcelWithCustomTable(components);
|
||||
SuspendLayout();
|
||||
//
|
||||
// customDataGridView1
|
||||
//
|
||||
customDataGridView1.Location = new Point(480, 36);
|
||||
customDataGridView1.Location = new Point(376, 36);
|
||||
customDataGridView1.Margin = new Padding(3, 4, 3, 4);
|
||||
customDataGridView1.Name = "customDataGridView1";
|
||||
customDataGridView1.Size = new Size(295, 231);
|
||||
customDataGridView1.Size = new Size(623, 231);
|
||||
customDataGridView1.TabIndex = 0;
|
||||
//
|
||||
// customListBox1
|
||||
@ -63,7 +71,6 @@
|
||||
dateBoxWithNull1.Name = "dateBoxWithNull1";
|
||||
dateBoxWithNull1.Size = new Size(262, 34);
|
||||
dateBoxWithNull1.TabIndex = 2;
|
||||
dateBoxWithNull1.Value = null;
|
||||
//
|
||||
// buttonClear
|
||||
//
|
||||
@ -73,7 +80,7 @@
|
||||
buttonClear.TabIndex = 3;
|
||||
buttonClear.Text = "Clear List";
|
||||
buttonClear.UseVisualStyleBackColor = true;
|
||||
buttonClear.Click += buttonClear_Click;
|
||||
buttonClear.Click += ButtonListClear_Click;
|
||||
//
|
||||
// buttonLoad
|
||||
//
|
||||
@ -83,7 +90,7 @@
|
||||
buttonLoad.TabIndex = 4;
|
||||
buttonLoad.Text = "Load List";
|
||||
buttonLoad.UseVisualStyleBackColor = true;
|
||||
buttonLoad.Click += buttonLoad_Click;
|
||||
buttonLoad.Click += ButtonLoadList_Click;
|
||||
//
|
||||
// buttonClearTable
|
||||
//
|
||||
@ -93,7 +100,7 @@
|
||||
buttonClearTable.TabIndex = 5;
|
||||
buttonClearTable.Text = "Table clear";
|
||||
buttonClearTable.UseVisualStyleBackColor = true;
|
||||
buttonClearTable.Click += buttonClearTable_Click;
|
||||
buttonClearTable.Click += ButtonClear_Click;
|
||||
//
|
||||
// buttonTableAdd
|
||||
//
|
||||
@ -103,7 +110,7 @@
|
||||
buttonTableAdd.TabIndex = 6;
|
||||
buttonTableAdd.Text = "Add Table";
|
||||
buttonTableAdd.UseVisualStyleBackColor = true;
|
||||
buttonTableAdd.Click += buttonTableAdd_Click;
|
||||
buttonTableAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// buttonGetValue
|
||||
//
|
||||
@ -112,8 +119,7 @@
|
||||
buttonGetValue.Size = new Size(94, 29);
|
||||
buttonGetValue.TabIndex = 7;
|
||||
buttonGetValue.Text = "Get Value";
|
||||
buttonGetValue.UseVisualStyleBackColor = true;
|
||||
buttonGetValue.Click += buttonGetValue_Click;
|
||||
buttonGetValue.Click += ButtonSel_Click;
|
||||
//
|
||||
// buttonGetValueCheckBox
|
||||
//
|
||||
@ -123,7 +129,7 @@
|
||||
buttonGetValueCheckBox.TabIndex = 8;
|
||||
buttonGetValueCheckBox.Text = "Get value";
|
||||
buttonGetValueCheckBox.UseVisualStyleBackColor = true;
|
||||
buttonGetValueCheckBox.Click += buttonGetValueCheckBox_Click;
|
||||
buttonGetValueCheckBox.Click += ButtonGetValue_Click;
|
||||
//
|
||||
// buttonSetValueCheckBox
|
||||
//
|
||||
@ -133,13 +139,58 @@
|
||||
buttonSetValueCheckBox.TabIndex = 9;
|
||||
buttonSetValueCheckBox.Text = "Set value";
|
||||
buttonSetValueCheckBox.UseVisualStyleBackColor = true;
|
||||
buttonSetValueCheckBox.Click += buttonSetValueCheckBox_Click;
|
||||
buttonSetValueCheckBox.Click += ButtonSetValue_Click;
|
||||
//
|
||||
// textBoxEvent
|
||||
//
|
||||
textBoxEvent.Location = new Point(59, 422);
|
||||
textBoxEvent.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxEvent.Name = "textBoxEvent";
|
||||
textBoxEvent.Size = new Size(182, 27);
|
||||
textBoxEvent.TabIndex = 10;
|
||||
//
|
||||
// buttonExcel
|
||||
//
|
||||
buttonExcel.Location = new Point(59, 509);
|
||||
buttonExcel.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonExcel.Name = "buttonExcel";
|
||||
buttonExcel.Size = new Size(86, 31);
|
||||
buttonExcel.TabIndex = 12;
|
||||
buttonExcel.Text = "Excel Save";
|
||||
buttonExcel.UseVisualStyleBackColor = true;
|
||||
buttonExcel.Click += buttonExcel_Click;
|
||||
//
|
||||
// excelSaveHeader
|
||||
//
|
||||
excelSaveHeader.Location = new Point(171, 509);
|
||||
excelSaveHeader.Margin = new Padding(3, 4, 3, 4);
|
||||
excelSaveHeader.Name = "excelSaveHeader";
|
||||
excelSaveHeader.Size = new Size(147, 31);
|
||||
excelSaveHeader.TabIndex = 13;
|
||||
excelSaveHeader.Text = "Save With Header";
|
||||
excelSaveHeader.UseVisualStyleBackColor = true;
|
||||
excelSaveHeader.Click += excelSaveHeader_Click;
|
||||
//
|
||||
// SaveBar
|
||||
//
|
||||
SaveBar.Location = new Point(343, 509);
|
||||
SaveBar.Margin = new Padding(3, 4, 3, 4);
|
||||
SaveBar.Name = "SaveBar";
|
||||
SaveBar.Size = new Size(168, 31);
|
||||
SaveBar.TabIndex = 14;
|
||||
SaveBar.Text = "Save Bar";
|
||||
SaveBar.UseVisualStyleBackColor = true;
|
||||
SaveBar.Click += SaveBar_Click;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
ClientSize = new Size(1011, 553);
|
||||
Controls.Add(SaveBar);
|
||||
Controls.Add(excelSaveHeader);
|
||||
Controls.Add(buttonExcel);
|
||||
Controls.Add(textBoxEvent);
|
||||
Controls.Add(buttonSetValueCheckBox);
|
||||
Controls.Add(buttonGetValueCheckBox);
|
||||
Controls.Add(buttonGetValue);
|
||||
@ -153,6 +204,7 @@
|
||||
Name = "Form1";
|
||||
Text = "Form1";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -167,5 +219,12 @@
|
||||
private Button buttonGetValue;
|
||||
private Button buttonGetValueCheckBox;
|
||||
private Button buttonSetValueCheckBox;
|
||||
private TextBox textBoxEvent;
|
||||
private Button buttonExcel;
|
||||
private Button excelSaveHeader;
|
||||
private Button SaveBar;
|
||||
private KryukovLib.ExcelTable excelTable1;
|
||||
private KryukovLib.ExcelGistogram excelGistogram1;
|
||||
private KryukovLib.ExcelWithCustomTable excelWithCustomTable1;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
using KryukovLib.Models;
|
||||
using KryukovLib;
|
||||
using Microsoft.VisualBasic.Devices;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Header;
|
||||
using static KryukovLib.CustomDataGridView;
|
||||
|
||||
namespace Test
|
||||
{
|
||||
@ -10,98 +9,70 @@ namespace Test
|
||||
private bool EmptyFill = false;
|
||||
readonly List<Car> cars = new()
|
||||
{
|
||||
new Car { Id = 0, marka = "Nissan terrano", weight = 1300, maxSpeed = 155 },
|
||||
new Car { Id = 1, marka = "Nissan X-Trail", weight = 1500, maxSpeed = 170 },
|
||||
new Car { Id = 2, marka = "Zhigyl)", weight = 400, maxSpeed = 100 },
|
||||
new Car { Id = 3, marka = "Chevrolet rezo", weight = 1200, maxSpeed = 140 },
|
||||
|
||||
};
|
||||
|
||||
readonly List<string> items = new()
|
||||
{
|
||||
new string("item1"),
|
||||
new string("item2"),
|
||||
new string("item3"),
|
||||
new string("item4"),
|
||||
new string("item5"),
|
||||
new string("item6"),
|
||||
new string("item7"),
|
||||
|
||||
new Car { Id = 0, marka = "Nissan", weight = 1500, maxSpeed = 150 },
|
||||
new Car { Id = 1, marka = "Cadillac", weight = 1600, maxSpeed = 200 },
|
||||
new Car { Id = 2, marka = "Toyota", weight = 1700, maxSpeed = 180 },
|
||||
new Car { Id = 3, marka = "Opel", weight = 1200, maxSpeed = 160 },
|
||||
new Car { Id = 4, marka = "Audi", weight = 1300, maxSpeed = 280 }
|
||||
};
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
CreateList();
|
||||
}
|
||||
|
||||
customListBox1.ValueChanged += CustomListBox1_ValueChanged;
|
||||
}
|
||||
private void CustomListBox1_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Âûâîäèì âûáðàííîå çíà÷åíèå
|
||||
MessageBox.Show($"Selected item: {customListBox1.SelectedValue}");
|
||||
}
|
||||
private void CreateList()
|
||||
{
|
||||
|
||||
customListBox1.PopulateList(items);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
customListBox1.ItemCollection.Add($"Item-{i}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void CreateTable()
|
||||
{
|
||||
customDataGridView1.ConfigColumn(new()
|
||||
customDataGridView1.ClearDataGrid();
|
||||
|
||||
customDataGridView1.ConfigColumn(new ColumnsConfiguratoin
|
||||
{
|
||||
ColumnsCount = 4,
|
||||
NameColumn = new string[] { "Id", "marka", "weight", "maxSpeed" },
|
||||
Width = new int[] { 10, 150, 250, 200 },
|
||||
Visible = new bool[] { false, true, true, true },
|
||||
Width = new int[] { 50, 150, 150, 150 },
|
||||
Visible = new bool[] { true, true, true, true },
|
||||
PropertiesObject = new string[] { "Id", "marka", "weight", "maxSpeed" }
|
||||
});
|
||||
|
||||
// Äîáàâëÿåì äàííûå äëÿ êàæäîé ìàøèíû
|
||||
foreach (Car car in cars)
|
||||
{
|
||||
int rowIndex = customDataGridView1.Rows.Add();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
customDataGridView1.AddItem(car, rowIndex, i);
|
||||
}
|
||||
customDataGridView1.AddItem(car, customDataGridView1.Rows.Count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void buttonClear_Click(object sender, EventArgs e)
|
||||
private void ButtonListClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
customListBox1.ClearList();
|
||||
}
|
||||
|
||||
private void buttonLoad_Click(object sender, EventArgs e)
|
||||
private void ButtonLoadList_Click(object sender, EventArgs e)
|
||||
{
|
||||
CreateList();
|
||||
customListBox1.Refresh();
|
||||
}
|
||||
|
||||
private void buttonClearTable_Click(object sender, EventArgs e)
|
||||
private void CustomListBox_ChangeEvent(object sender, EventArgs e)
|
||||
{
|
||||
customDataGridView1.ClearDataGrid();
|
||||
object? selectedItem = customListBox1.SelectedValue;
|
||||
MessageBox.Show($"Change selected item {selectedItem?.ToString()}");
|
||||
}
|
||||
|
||||
private void buttonTableAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
CreateTable();
|
||||
}
|
||||
|
||||
private void buttonGetValue_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void buttonGetValueCheckBox_Click(object sender, EventArgs e)
|
||||
private void ButtonGetValue_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show($"Value is {dateBoxWithNull1.Value}");
|
||||
}
|
||||
|
||||
private void buttonSetValueCheckBox_Click(object sender, EventArgs e)
|
||||
private void ButtonSetValue_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (EmptyFill)
|
||||
{
|
||||
@ -113,5 +84,87 @@ namespace Test
|
||||
}
|
||||
EmptyFill = !EmptyFill;
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
CreateTable();
|
||||
}
|
||||
|
||||
private void ButtonClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
customDataGridView1.ClearDataGrid();
|
||||
}
|
||||
|
||||
private void ButtonSel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Car? car = customDataGridView1.GetSelectedObjectInRow<Car>();
|
||||
if (car is null) return;
|
||||
MessageBox.Show($"{car.Id}-{car.marka}-{car.weight}-{car.maxSpeed}");
|
||||
}
|
||||
|
||||
private void buttonExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
(sender as Control).BackColor = Color.White;
|
||||
excelTable1.CreateDoc(new KryukovLib.Models.TableConfig
|
||||
{
|
||||
FilePath = "table.xlsx",
|
||||
Header = "Example",
|
||||
Data = new List<string[,]>
|
||||
{
|
||||
new string[,] {
|
||||
{ "1", "1", "1" },
|
||||
{ "1", "2", "2" },
|
||||
{ "1", "3", "3" }
|
||||
},
|
||||
new string[,] { { "\n",} },
|
||||
new string[,] {
|
||||
{ "2", "3", "3" },
|
||||
{ "3", "4", "4" },
|
||||
{ "4", "5", "5" },
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
(sender as Control).BackColor = Color.Green;
|
||||
}
|
||||
|
||||
private void excelSaveHeader_Click(object sender, EventArgs e)
|
||||
{
|
||||
(sender as Control).BackColor = Color.White;
|
||||
excelWithCustomTable1.CreateDoc(new KryukovLib.Models.TableWithHeaderConfig<Car>
|
||||
{
|
||||
FilePath = "header.xlsx",
|
||||
Header = "Cars",
|
||||
ColumnsRowsWidth = new List<(int Column, int Row)> { (5, 5), (10, 5), (10, 0), (5, 0), (7, 0) },
|
||||
Headers = new List<(int ColumnIndex, string Header, string PropertyName)>
|
||||
{
|
||||
(0, "Id", "Id"),
|
||||
(1, "marka", "marka"),
|
||||
(2, "weight", "weight"),
|
||||
(3, "maxSpeed", "maxSpeed"),
|
||||
},
|
||||
Data = cars,
|
||||
});
|
||||
(sender as Control).BackColor = Color.Green;
|
||||
}
|
||||
|
||||
private void SaveBar_Click(object sender, EventArgs e)
|
||||
{
|
||||
(sender as Control).BackColor = Color.White;
|
||||
var rnd = new Random();
|
||||
excelGistogram1.CreateDoc(new ChartConfig
|
||||
{
|
||||
FilePath = "bar.xlsx",
|
||||
Header = "Chart",
|
||||
ChartTitle = "BarChart",
|
||||
LegendLocation = KryukovLib.Models.Location.Top,
|
||||
Data = new Dictionary<string, List<(string Name, double Value)>>
|
||||
{
|
||||
{ "Series 1", new() { ("Series 2", rnd.Next()), ("Series 3", rnd.Next()), ("Series 52", rnd.Next()) } }
|
||||
}
|
||||
});
|
||||
(sender as Control).BackColor = Color.Green;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,4 +117,13 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="excelTable1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="excelGistogram1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>150, 17</value>
|
||||
</metadata>
|
||||
<metadata name="excelWithCustomTable1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>317, 17</value>
|
||||
</metadata>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user