Add control elements for columns.

- NEU: Steuer-Elemente für Spalten.
This commit is contained in:
Daniel Kraus
2015-08-09 20:54:43 +02:00
parent 5833e0fcb7
commit a009c1ab39
13 changed files with 192 additions and 42 deletions

View File

@ -121,6 +121,8 @@ namespace zaaReloaded2.Formatter
{
if (!CanRun) throw new InvalidOperationException("No laboratory data to format.");
CreateParagraphStyle();
_secondaryBuffer.ParagraphStyle = zaaReloaded2.Properties.Settings.Default.ParagraphStyleName;
int current = 0;
while (current < Settings.Elements.Count)
{
@ -145,8 +147,6 @@ namespace zaaReloaded2.Formatter
current++;
}
}
CreateParagraphStyle();
_secondaryBuffer.ParagraphStyle = zaaReloaded2.Properties.Settings.Default.ParagraphStyleName;
_secondaryBuffer.Flush();
}
@ -208,6 +208,39 @@ namespace zaaReloaded2.Formatter
ProcessAllTimePoints(controlElement.Children);
}
/// <summary>
/// Inserts a table with two columns into the document.
/// </summary>
public void InsertTwoColumns()
{
_secondaryBuffer.Flush();
if (Document != null)
{
Range r = Document.ActiveWindow.Selection.Range;
_table = Document.Tables.Add(r, NumRows: 1, NumColumns: 2);
_table.AllowAutoFit = true;
_table.AutoFitBehavior(WdAutoFitBehavior.wdAutoFitWindow);
_table.PreferredWidthType = WdPreferredWidthType.wdPreferredWidthPercent;
_table.PreferredWidth = 100;
_table.Borders.Enable = 0;
}
}
/// <summary>
/// Moves the insertion point to the next column in a layout
/// table.
/// </summary>
public void NextColumn()
{
if (_table == null)
{
throw new InvalidOperationException(
"Kann nicht zur nächsten Spalte wechseln, da bislang keine Tabelle eingefügt wurde.");
}
_secondaryBuffer.Flush();
Document.ActiveWindow.Selection.MoveRight(WdUnits.wdCell);
}
/// <summary>
/// Creates a zaaReloaded2 paragraph style in the document.
/// </summary>
@ -324,6 +357,7 @@ namespace zaaReloaded2.Formatter
Laboratory _laboratory;
DocumentWriter _primaryBuffer;
DocumentWriter _secondaryBuffer;
Table _table;
#endregion
}