Implement text styles.

- NEU: Überschriften und pathologische Werte werden jetzt besonders ausgezeichnet (fett).
This commit is contained in:
Daniel Kraus
2015-08-15 20:14:24 +02:00
parent 4cb2999297
commit 92a8faa972
8 changed files with 113 additions and 29 deletions

View File

@ -121,8 +121,7 @@ namespace zaaReloaded2.Formatter
{
if (!CanRun) throw new NoLaboratoryDataException("No laboratory data to format.");
CreateParagraphStyle();
_secondaryBuffer.ParagraphStyle = zaaReloaded2.Properties.Settings.Default.ParagraphStyleName;
CreateStyles();
int current = 0;
while (current < Settings.Elements.Count)
{
@ -242,9 +241,9 @@ namespace zaaReloaded2.Formatter
}
/// <summary>
/// Creates a zaaReloaded2 paragraph style in the document.
/// Creates a paragraph and character styles in the document.
/// </summary>
public void CreateParagraphStyle()
public void CreateStyles()
{
if (Document != null)
{
@ -253,19 +252,55 @@ namespace zaaReloaded2.Formatter
// paragraph style than by using a try...catch construction.
try
{
style = Document.Styles[Properties.Settings.Default.ParagraphStyleName];
style = Document.Styles[Properties.Settings.Default.StyleParagraph];
}
catch
{
style = Document.Styles.Add(Properties.Settings.Default.ParagraphStyleName);
// Add default paragraph style for laboratory
style = Document.Styles.Add(Properties.Settings.Default.StyleParagraph);
style.Font.Size = 10; // pt
style.Font.Bold = 0;
style.Font.Italic = 0;
style.Font.Underline = 0;
style.ParagraphFormat.SpaceAfter = 0;
style.ParagraphFormat.SpaceBefore = 0;
style.ParagraphFormat.LeftIndent = 36; // pt
style.ParagraphFormat.FirstLineIndent = -36; // pt
style.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphJustify;
}
try
{
style = Document.Styles[Properties.Settings.Default.StyleHeader];
}
catch
{
// Add header paragraph style for laboratory
style = Document.Styles.Add(Properties.Settings.Default.StyleHeader);
style.Font.Size = 10; // pt
style.Font.Bold = 1;
style.Font.Italic = 0;
style.Font.Underline = WdUnderline.wdUnderlineSingle;
style.ParagraphFormat.SpaceAfter = 0;
style.ParagraphFormat.SpaceBefore = 12;
style.ParagraphFormat.LeftIndent = 36; // pt
style.ParagraphFormat.FirstLineIndent = -36; // pt
style.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphJustify;
style.set_NextParagraphStyle(Document.Styles[Properties.Settings.Default.StyleParagraph]);
}
try
{
style = Document.Styles[Properties.Settings.Default.StyleAbnormal];
}
catch
{
// Add character style for abnormal parameters
style = Document.Styles.Add(
Properties.Settings.Default.StyleAbnormal,
WdStyleType.wdStyleTypeCharacter);
style.Font.Bold = 1;
}
}
}