2024-10-11 04:47:06 +04:00
|
|
|
|
using DocumentFormat.OpenXml.Office2013.Excel;
|
|
|
|
|
using DocumentFormat.OpenXml.Spreadsheet;
|
|
|
|
|
using Microsoft.VisualBasic.Devices;
|
2024-09-27 01:08:40 +04:00
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using YunusovComponentsLibrary;
|
|
|
|
|
using YunusovComponentsLibrary.Exceptions;
|
2024-10-11 04:47:06 +04:00
|
|
|
|
using YunusovComponentsLibrary.OfficePackage.HelperModels;
|
2024-09-27 01:08:40 +04:00
|
|
|
|
|
|
|
|
|
namespace Form1
|
|
|
|
|
{
|
|
|
|
|
public partial class Form1 : Form
|
|
|
|
|
{
|
|
|
|
|
public Form1()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InitializeSelectComponent();
|
|
|
|
|
InitializeInputComponent();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private void InitializeSelectComponent()
|
|
|
|
|
{
|
|
|
|
|
selectComponent.Input("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1");
|
|
|
|
|
selectComponent.Input("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2");
|
|
|
|
|
selectComponent.Input("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3");
|
|
|
|
|
selectComponent.Input("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4");
|
|
|
|
|
selectComponent.Input("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5");
|
|
|
|
|
}
|
|
|
|
|
private void SelectComponent_ItemSelected(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(selectComponent.SelectedItem);
|
|
|
|
|
}
|
|
|
|
|
private void buttonAdd_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (textBox.Text != "")
|
|
|
|
|
selectComponent.Input(textBox.Text);
|
|
|
|
|
}
|
|
|
|
|
private void buttonClearList_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
selectComponent.ClearList();
|
|
|
|
|
}
|
|
|
|
|
private void InitializeInputComponent()
|
|
|
|
|
{
|
|
|
|
|
inputComponent.FloatValue = 12.3f;
|
|
|
|
|
}
|
|
|
|
|
private void buttonShowFloat_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
float? Value = inputComponent.FloatValue;
|
|
|
|
|
if (Value != null)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show($"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>: {Value}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - null");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (NotFloatException ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
catch (EmptyValueException ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void InitializeDataGridViewComponent()
|
|
|
|
|
{
|
|
|
|
|
listOutputComponent.ConfigColumn(new()
|
|
|
|
|
{
|
2024-10-11 04:47:06 +04:00
|
|
|
|
new ColumnInfo("", 0, false, "Id"),
|
|
|
|
|
new ColumnInfo("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 150, true, "Name"),
|
|
|
|
|
new ColumnInfo("<22><><EFBFBD>", 100, true, "Surname"),
|
|
|
|
|
new ColumnInfo("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 100, true, "Age"),
|
2024-09-27 01:08:40 +04:00
|
|
|
|
});
|
|
|
|
|
List<TestPerson> Persons = new()
|
|
|
|
|
{
|
|
|
|
|
new TestPerson(1, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 20),
|
|
|
|
|
new TestPerson(2, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 20),
|
|
|
|
|
new TestPerson(3, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 59),
|
|
|
|
|
new TestPerson(4, "<22><><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>", 25),
|
|
|
|
|
new TestPerson(5, "<22><><EFBFBD>", "<22><><EFBFBD><EFBFBD>", 89),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
foreach (TestPerson person in Persons)
|
|
|
|
|
{
|
|
|
|
|
listOutputComponent.AddItem(person);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonAddListOutput_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
InitializeDataGridViewComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonClearListOutput_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
listOutputComponent.ClearDataGridView();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonGetListOutput_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var Test = listOutputComponent.GetSelectedObject<TestPerson>();
|
|
|
|
|
MessageBox.Show(Test.ToString());
|
|
|
|
|
}
|
2024-10-11 04:47:06 +04:00
|
|
|
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
private void buttonSimpleTable_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
List<string[,]> data = new List<string[,]>
|
|
|
|
|
{
|
|
|
|
|
new string[,]
|
|
|
|
|
{
|
|
|
|
|
{ "<22><><EFBFBD> 1 <20><><EFBFBD> 1", "<22><><EFBFBD> 1 <20><><EFBFBD> 2", "<22><><EFBFBD> 1 <20><><EFBFBD> 3" },
|
|
|
|
|
{ "<22><><EFBFBD> 2 <20><><EFBFBD> 1", "<22><><EFBFBD> 2 <20><><EFBFBD> 2", "<22><><EFBFBD> 2 <20><><EFBFBD> 3" }
|
|
|
|
|
},
|
|
|
|
|
new string[,]
|
|
|
|
|
{
|
|
|
|
|
{ "<22><><EFBFBD> 1 <20><><EFBFBD> 1", "<22><><EFBFBD> 1 <20><><EFBFBD> 2", "<22><><EFBFBD> 1 <20><><EFBFBD> 3", "<22><><EFBFBD> 1 <20><><EFBFBD> 4", "<22><><EFBFBD> 1 <20><><EFBFBD> 5", "<22><><EFBFBD> 1 <20><><EFBFBD> 6" },
|
|
|
|
|
{ "<22><><EFBFBD> 2 <20><><EFBFBD> 1", "<22><><EFBFBD> 2 <20><><EFBFBD> 2", "<22><><EFBFBD> 2 <20><><EFBFBD> 3", "<22><><EFBFBD> 2 <20><><EFBFBD> 4", "<22><><EFBFBD> 2 <20><><EFBFBD> 5", "<22><><EFBFBD> 2 <20><><EFBFBD> 6" },
|
|
|
|
|
{ "<22><><EFBFBD> 3 <20><><EFBFBD> 1", "<22><><EFBFBD> 3 <20><><EFBFBD> 2", "<22><><EFBFBD> 3 <20><><EFBFBD> 3", "<22><><EFBFBD> 3 <20><><EFBFBD> 4", "<22><><EFBFBD> 3 <20><><EFBFBD> 5", "<22><><EFBFBD> 3 <20><><EFBFBD> 6" },
|
|
|
|
|
{ "<22><><EFBFBD> 4 <20><><EFBFBD> 1", "<22><><EFBFBD> 4 <20><><EFBFBD> 2", "<22><><EFBFBD> 4 <20><><EFBFBD> 3", "<22><><EFBFBD> 4 <20><><EFBFBD> 4", "<22><><EFBFBD> 4 <20><><EFBFBD> 5", "<22><><EFBFBD> 4 <20><><EFBFBD> 6" },
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
var info = new WordSimpleTable
|
|
|
|
|
{
|
|
|
|
|
FileName = "C://Users//niyaz//WordSimpleTable.docx",
|
|
|
|
|
Title = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
|
|
|
|
Table = data,
|
|
|
|
|
};
|
|
|
|
|
wordDocumentContext1.CreateWord(info);
|
|
|
|
|
MessageBox.Show("Word <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "<22><><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
readonly List<PersonWordTable> PersonsWord = new()
|
|
|
|
|
{
|
|
|
|
|
new PersonWordTable("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 20, 2000.1),
|
|
|
|
|
new PersonWordTable("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 20, 3000.5),
|
|
|
|
|
new PersonWordTable("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 59, 1001.3),
|
|
|
|
|
new PersonWordTable("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>", 25, 1234.23),
|
|
|
|
|
new PersonWordTable("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD>", "<22><><EFBFBD><EFBFBD>", 89, 1457.34),
|
|
|
|
|
};
|
|
|
|
|
private void WordSaveHeaders_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
wordDocumentTable1.CreateTable(new WordTableWithData<PersonWordTable>
|
|
|
|
|
{
|
|
|
|
|
FileName = "C://Users//niyaz//OneDrive//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//HeaderTable.docx",
|
|
|
|
|
Title = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
|
|
|
|
ColumnsRowsWidth = new List<(int Column, int Row)> { (5, 5), (10, 5), (10, 0), (5, 0), (10,5) },
|
|
|
|
|
Headers = new List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)>
|
|
|
|
|
{
|
|
|
|
|
(0, 0, "Division", "Id"),
|
|
|
|
|
(1, 0, "Surname", "Surname"),
|
|
|
|
|
(2, 0, "Name", "Name"),
|
|
|
|
|
(3, 0, "Age", "Age"),
|
|
|
|
|
(4, 0, "Premia", "Premia"),
|
|
|
|
|
},
|
|
|
|
|
Data = PersonsWord,
|
|
|
|
|
NullReplace = "null"
|
|
|
|
|
});
|
|
|
|
|
MessageBox.Show("Word <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "<22><><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
private void createDiagram_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
wordDiagram.CreateDiagram(
|
|
|
|
|
new WordDiagramInfo
|
|
|
|
|
{
|
|
|
|
|
FileName = "C://Users//niyaz//OneDrive//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//Diagram.docx",
|
|
|
|
|
Title = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
|
|
|
|
ChartTitle = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
|
|
|
|
LegendLocation = YunusovComponentsLibrary.OfficePackage.HelperEnum.WordDiagramLegendLocation.Top,
|
|
|
|
|
Series = new WordDiagramSeries
|
|
|
|
|
{
|
|
|
|
|
SeriesName = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
|
|
|
|
Data = new Dictionary<string, double>
|
|
|
|
|
{
|
|
|
|
|
{ "Windows", 71 },
|
|
|
|
|
{ "OS X", 15.5 },
|
|
|
|
|
{ "Linux", 4.5 },
|
|
|
|
|
{ "Others", 8.5 },
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
MessageBox.Show("Word <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "<22><><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show($"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: {ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2024-09-27 01:08:40 +04:00
|
|
|
|
}
|
|
|
|
|
}
|