From 708c8183365bfcc01a7316beac3d101cee435e18 Mon Sep 17 00:00:00 2001 From: "ityurner02@mail.ru" Date: Wed, 11 Oct 2023 18:28:46 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BC=D0=B0=D0=BB=D0=B5=D0=BD=D1=8C=D0=BA?= =?UTF-8?q?=D0=BE=D0=B5=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- COP/VisualCompLib/Components/WordText.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/COP/VisualCompLib/Components/WordText.cs b/COP/VisualCompLib/Components/WordText.cs index 0bb53c9..479307f 100644 --- a/COP/VisualCompLib/Components/WordText.cs +++ b/COP/VisualCompLib/Components/WordText.cs @@ -25,9 +25,9 @@ namespace VisualCompLib.Components 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); @@ -119,5 +119,15 @@ namespace VisualCompLib.Components doc.Save(); } } + + bool CheckData(string[] data) + { + for (int i = 0; i < data.Length; i++) + { + if (string.IsNullOrEmpty(data[i])) return false; + } + + return true; + } } }