маленькое изменение
This commit is contained in:
parent
4ff7ba2931
commit
708c818336
@ -25,9 +25,9 @@ namespace VisualCompLib.Components
|
|||||||
|
|
||||||
public void CreateWordText(LargeText largeText)
|
public void CreateWordText(LargeText largeText)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(largeText.FilePath) || string.IsNullOrEmpty(largeText.DocumentTitle) || largeText.TextData.Length == 0)
|
if (string.IsNullOrEmpty(largeText.FilePath) || string.IsNullOrEmpty(largeText.DocumentTitle) || !CheckData(largeText.TextData))
|
||||||
{
|
{
|
||||||
return;
|
throw new Exception("Не все данные заполнены");
|
||||||
}
|
}
|
||||||
_wordDocument = WordprocessingDocument.Create(largeText.FilePath, WordprocessingDocumentType.Document);
|
_wordDocument = WordprocessingDocument.Create(largeText.FilePath, WordprocessingDocumentType.Document);
|
||||||
|
|
||||||
@ -119,5 +119,15 @@ namespace VisualCompLib.Components
|
|||||||
doc.Save();
|
doc.Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CheckData(string[] data)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < data.Length; i++)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(data[i])) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user