From ae66a9dfd2425892fba45ff898dc77b804f30f7e Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Sat, 18 Jul 2015 22:22:40 +0200 Subject: [PATCH] Implement WriteToDocument method in Formatter. --- zaaReloaded2/Formatter/Formatter.cs | 14 ++++++++++++++ zaaReloaded2/Formatter/ItemFormatter.cs | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/zaaReloaded2/Formatter/Formatter.cs b/zaaReloaded2/Formatter/Formatter.cs index c82210d..f19e380 100755 --- a/zaaReloaded2/Formatter/Formatter.cs +++ b/zaaReloaded2/Formatter/Formatter.cs @@ -88,6 +88,20 @@ namespace zaaReloaded2.Formatter #region Public methods + /// + /// Writes some text to the current document. + /// Does nothing if there is no current document. + /// + /// Text to write to the current document. + /// + public void WriteToDocument(string text) + { + if (Document != null) + { + Document.Range().InsertAfter(text); + } + } + /// /// Formats the laboratory and writes it to a Word document. /// diff --git a/zaaReloaded2/Formatter/ItemFormatter.cs b/zaaReloaded2/Formatter/ItemFormatter.cs index 1bf7e20..39c3bb7 100755 --- a/zaaReloaded2/Formatter/ItemFormatter.cs +++ b/zaaReloaded2/Formatter/ItemFormatter.cs @@ -70,7 +70,7 @@ namespace zaaReloaded2.Formatter /// Formats and writes the LabItem details to a word . /// /// Word document to write to. - public void WriteToDocument(Document document) + public void WriteToDocument(Formatter formatter) { string reference; if ( @@ -134,7 +134,7 @@ namespace zaaReloaded2.Formatter } // Insert the formatted text into the document. - document.Range().InsertAfter( + formatter.WriteToDocument( String.Format( "{0} {1}{2}{3}", LabItem.QualifiedName,