Реализовал сохранение списка изделий в word
This commit is contained in:
parent
f47e53df7d
commit
e37e94a14f
@ -79,13 +79,13 @@ namespace SecuritySystemBusinessLogic.BusinessLogics
|
||||
/// Сохранение компонент в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
public void SaveComponentsToWordFile(ReportBindingModel model)
|
||||
public void SaveSecuresToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список компонент",
|
||||
Components = _componentStorage.GetFullList()
|
||||
Title = "Список изделий",
|
||||
Secures = _secureStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -17,11 +17,14 @@ namespace SecuritySystemBusinessLogic.OfficePackage
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
foreach (var component in info.Components)
|
||||
foreach (var secure in info.Secures)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (component.ComponentName, new WordTextProperties { Size = "24", }) },
|
||||
Texts = new List<(string, WordTextProperties)> {
|
||||
(secure.SecureName, new WordTextProperties { Bold = true, Size = "24", }),
|
||||
("\t" + secure.Price.ToString() + " руб.", new WordTextProperties { Size = "24", })
|
||||
},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
|
@ -6,6 +6,6 @@ namespace SecuritySystemBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ComponentViewModel> Components { get; set; } = new();
|
||||
public List<SecureViewModel> Secures { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace SecuritySystemContracts.BusinessLogicsContracts
|
||||
/// Сохранение компонент в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveComponentsToWordFile(ReportBindingModel model);
|
||||
void SaveSecuresToWordFile(ReportBindingModel model);
|
||||
/// <summary>
|
||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
||||
/// </summary>
|
||||
|
@ -88,8 +88,8 @@
|
||||
//
|
||||
списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
|
||||
списокКомпонентовToolStripMenuItem.Size = new Size(276, 26);
|
||||
списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
|
||||
списокКомпонентовToolStripMenuItem.Click += ReportComponentsToolStripMenuItem_Click;
|
||||
списокКомпонентовToolStripMenuItem.Text = "Список изделий";
|
||||
списокКомпонентовToolStripMenuItem.Click += ReportSecuresToolStripMenuItem_Click;
|
||||
//
|
||||
// компонентыПоИзделиямToolStripMenuItem
|
||||
//
|
||||
|
@ -140,12 +140,12 @@ namespace SecuritySystemView
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void ReportComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void ReportSecuresToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel
|
||||
_reportLogic.SaveSecuresToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = dialog.FileName
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user