Output formatting.

- NEU: Formatierung der Ausgabe mit Absatzvorlage.
This commit is contained in:
Daniel Kraus 2015-08-05 21:52:06 +02:00
parent d0bd7dd2a5
commit 2cefede3c0
5 changed files with 58 additions and 1 deletions

View File

@ -53,6 +53,12 @@ namespace zaaReloaded2.Formatter
/// </summary>
public bool HasBufferedText { get { return _buffer.Length > 0; } }
/// <summary>
/// Gets or sets the desired paragraph style when flushing into
/// a Document.
/// </summary>
public string ParagraphStyle { get; set; }
#endregion
#region Constructors
@ -113,7 +119,13 @@ namespace zaaReloaded2.Formatter
if (Document != null)
{
Document.Range().Text = _buffer.ToString();
Document.ActiveWindow.Selection.ClearCharacterDirectFormatting();
Document.ActiveWindow.Selection.ClearParagraphDirectFormatting();
if (!string.IsNullOrEmpty(ParagraphStyle))
{
Document.ActiveWindow.Selection.set_Style(ParagraphStyle);
}
Document.ActiveWindow.Selection.Range.Text = _buffer.ToString();
}
if (Parent != null)
{

View File

@ -145,6 +145,8 @@ namespace zaaReloaded2.Formatter
current++;
}
}
CreateParagraphStyle();
_secondaryBuffer.ParagraphStyle = zaaReloaded2.Properties.Settings.Default.ParagraphStyleName;
_secondaryBuffer.Flush();
}
@ -206,6 +208,34 @@ namespace zaaReloaded2.Formatter
ProcessAllTimePoints(controlElement.FormatElements);
}
/// <summary>
/// Creates a zaaReloaded2 paragraph style in the document.
/// </summary>
public void CreateParagraphStyle()
{
if (Document != null)
{
Style style;
// Don't see a better way to check for the existence of a particular
// paragraph style than by using a try...catch construction.
try
{
style = Document.Styles[Properties.Settings.Default.ParagraphStyleName];
}
catch
{
style = Document.Styles.Add(Properties.Settings.Default.ParagraphStyleName);
style.Font.Size = 10; // pt
style.Font.Bold = 0;
style.Font.Italic = 0;
style.Font.Underline = 0;
style.ParagraphFormat.LeftIndent = 36; // pt
style.ParagraphFormat.FirstLineIndent = -36; // pt
style.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphJustify;
}
}
}
#endregion
#region Protected methods

View File

@ -245,5 +245,14 @@ namespace zaaReloaded2.Properties {
this["LastSettings"] = value;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("zaaReloaded2-Laborwerte")]
public string ParagraphStyleName {
get {
return ((string)(this["ParagraphStyleName"]));
}
}
}
}

View File

@ -74,5 +74,8 @@
<Setting Name="LastSettings" Type="System.Guid" Scope="User">
<Value Profile="(Default)">00000000-0000-0000-0000-000000000000</Value>
</Setting>
<Setting Name="ParagraphStyleName" Type="System.String" Scope="Application">
<Value Profile="(Default)">zaaReloaded2-Laborwerte</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -92,6 +92,9 @@
<setting name="DefaultItemsDrugs" serializeAs="String">
<value>Medikamente: TAC, CSA, SIR, Vancomycin, Gentamicin, Tobramicin</value>
</setting>
<setting name="ParagraphStyleName" serializeAs="String">
<value>zaaReloaded2-Laborwerte</value>
</setting>
</zaaReloaded2.Properties.Settings>
</applicationSettings>
<userSettings>