This commit is contained in:
Simon Martens
2022-01-20 18:02:47 +01:00
parent e13439d928
commit bf889b0bb0
9 changed files with 29542 additions and 1146 deletions

View File

@@ -580,17 +580,18 @@ namespace HamannPrinter
{
//erzeugt und formatiert die überschriften für editorische anmerkungen, kommentare und zusätze von fremder hand
// MakeFramedEmptyLines(wordDoc);
var run = new Run(new Break());
var run = new Run();
run.AppendChild(new Text(title));
BoldRun(run);
var headingPara = new Paragraph(run);
ApplyParaStyle(headingPara, "überlieferung");
var LineHeight = Int32.Parse(LineHight);
// FrameHeadingParagraph(headingPara);
headingPara.ParagraphProperties.AppendChild(new SpacingBetweenLines() { After = LineHight });
headingPara.ParagraphProperties.AppendChild(new SpacingBetweenLines() { After = (LineHeight / 2).ToString(), Before = LineHight });
headingPara.ParagraphProperties.AppendChild(new KeepNext() { Val = true });
headingPara.ParagraphProperties.AppendChild<SectionProperties>(new SectionProperties());
headingPara.ParagraphProperties.SectionProperties.AppendChild(new KeepNext() { Val = true });
headingPara.ParagraphProperties.SectionProperties.AppendChild(new Columns () { ColumnCount = 1 });
// headingPara.ParagraphProperties.SectionProperties.AppendChild(new KeepNext() { Val = true });
// headingPara.ParagraphProperties.SectionProperties.AppendChild(new Columns () { ColumnCount = 1 });
headingPara.ParagraphProperties.SectionProperties.AppendChild<SectionType>(new SectionType() { Val = SectionMarkValues.Continuous });
PageMargin pageMargin = new PageMargin() { Top = MarginTop, Right = MarginRight, Bottom = MarginBottom, Left = MarginLeft, Footer = MarginFooter };
headingPara.ParagraphProperties.SectionProperties.PrependChild(pageMargin);
@@ -816,9 +817,10 @@ namespace HamannPrinter
string emphParent = GetHighestParentNode(xelem).Trim();
if (emphParent == "letterTradition")
{
form = new Formatierer(LineBreakBefore);
form = new Formatierer(MarginBefore);
form += new Formatierer(BoldRun);
form += new Formatierer(SansSerifRun);
form += new Formatierer(KeepNextRun);
}
else
{
@@ -1901,6 +1903,27 @@ namespace HamannPrinter
run.PrependChild<Break>(new Break());
}
public static void MarginBefore(Run run, string arg = null)
{
Paragraph parent = run.Parent as Paragraph;
if (parent.ParagraphProperties == null)
{
parent.PrependChild<ParagraphProperties>(new ParagraphProperties());
}
ApplyParaStyle(parent, "ueberschrift");
}
public static void KeepNextRun(Run run, string arg = null)
{
Paragraph parent = run.Parent as Paragraph;
if (parent.ParagraphProperties == null)
{
parent.PrependChild<ParagraphProperties>(new ParagraphProperties());
}
parent.ParagraphProperties.AppendChild(new KeepNext() { Val = true });
}
public static void GreyBackRun(Run run, string arg = null)
{
RunProperties runprops = run.RunProperties;
@@ -1934,6 +1957,7 @@ namespace HamannPrinter
public static void SansSerifRun(Run run, string arg = null)
{
var test = run.Parent;
RunProperties runprops = run.RunProperties;
if (runprops == null)
{
@@ -2297,7 +2321,7 @@ namespace HamannPrinter
Style comm = CreateParaStyle(wordDoc, "kommentar", "kommentar", "kommentar", standardStyleName, justification: "left");
ParagraphProperties commProperties = comm.ChildElements.First<ParagraphProperties>();
commProperties.AppendChild(new KeepNext() {Val = true });
// BUG commProperties.AppendChild(new KeepNext() {Val = true });
commProperties.AppendChild<Indentation>(new Indentation() { Left = indentValue, Hanging = indentValue });
StyleRunProperties commRunProperties = comm.ChildElements.First<StyleRunProperties>();
commRunProperties.AppendChild(new RunFonts() { Ascii = SpecialFont, HighAnsi = SpecialFont, ComplexScript = SpecialFont });
@@ -2305,6 +2329,11 @@ namespace HamannPrinter
Style salutation = CreateParaStyle(wordDoc, "anrede", "anrede", standardStyleName, standardStyleName, justification: "left");
salutation.ChildElements.First<ParagraphProperties>().SpacingBetweenLines.After = LineHight;
Style ueberschrift = CreateParaStyle(wordDoc, "ueberschrift", "ueberschrift", standardStyleName, standardStyleName, justification: "left");
var LineHeight = Int32.Parse(LineHight) / 2;
ueberschrift.ChildElements.First<ParagraphProperties>().SpacingBetweenLines.Before = LineHight;
ueberschrift.ChildElements.First<ParagraphProperties>().SpacingBetweenLines.After = LineHeight.ToString();
Style footerStyle = CreateParaStyle(wordDoc, "fußzeile", "fußzeile", "fußzeile", "linksbündig", justification: "left");
ParagraphProperties paraProps = footerStyle.ChildElements.First<ParagraphProperties>();
paraProps.SpacingBetweenLines.Before.Value = FooterToText;

View File

@@ -628,10 +628,10 @@ namespace HamannPrinter
{
//fügt den absatz mit der überlieferung an das dokument an
var lastPara = GetLastPara(letter.WordDoc);
Paragraph traditonPara = new Paragraph(new Run(new Break()));
Paragraph traditonPara = new Paragraph(new Run());
lastPara.InsertAfterSelf<Paragraph>(traditonPara);
CreateTraditionPara(letter, traditonPara);
CreateColSection(letter.WordDoc, true);
// CreateColSection(letter.WordDoc, true);
}
public static Paragraph CreateTraditionPara(LetterObj letter, Paragraph tradPara)

View File

@@ -5,9 +5,13 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:HamannPrinter"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
Title="HamannPrinter" Height="450" Width="800" WindowStartupLocation="CenterOwner" WindowState="Minimized">
<Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="377*"/>
<ColumnDefinition Width="423*"/>
</Grid.ColumnDefinitions>
<Grid Grid.ColumnSpan="2">
<CheckBox x:Name="LetterDocs" Content="Brief.docx erzeugen" HorizontalAlignment="Left" Margin="40,34,0,0" VerticalAlignment="Top" Checked="SingleDocChanged" Unchecked="SingleDocChanged" IsChecked="True"/>
<CheckBox x:Name="VolumeDocs" Content="Jahr.docx erzeugen" HorizontalAlignment="Left" Margin="40,59,0,0" VerticalAlignment="Top" Checked="VolDocChanged" Unchecked="VolDocChanged" IsChecked="True"/>
<CheckBox x:Name="RegisterDocs" Content="Kommentar.docx erzeugen" HorizontalAlignment="Left" Margin="40,84,0,0" VerticalAlignment="Top" Unchecked="CommDocChanged" Checked="CommDocChanged" IsChecked="True"/>

View File

@@ -25,11 +25,12 @@ namespace HamannPrinter
{
InitializeComponent();
RegisterDocs.IsChecked = false;
VolumeDocs.IsChecked = false;
VolumeDocs.IsChecked = true;
StartYearTextBox.Text = "1751";
EndYearTextBox.Text = "1764";
XmlFileBox.Text = @"D:\dev\source\hamann-ausgabe-core\XML\XML"; // DEV
OutputDirBox.Text = @"D:\dev\source\hamann-ausgabe-core\XML\Ausg"; // DEV
Act(); // DEV
}
private void SingleDocChanged(object sender, RoutedEventArgs e)
@@ -77,6 +78,11 @@ namespace HamannPrinter
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Act();
}
private void Act()
{
/*Routine für "Dokumente ezeugen"-Button */
if (CheckInput())
@@ -207,12 +213,13 @@ namespace HamannPrinter
string path = MakePath(XmlFileBox.Text);
string file = path + "HAMANN.xml";
if (File.Exists(file))
{
var answer = System.Windows.MessageBox.Show("HAMANN.xml gefunden. \nZuletzt bearbeitet: " + File.GetLastWriteTime(file) + "\n\nSoll diese Datei verwendet werden, ohne eine neue aus den Einzeldokumenten zusammenzusetzen?",
"Confirmation",
MessageBoxButton.YesNo,
MessageBoxImage.Question);
if (answer == MessageBoxResult.Yes) return file;
{
// DEV
// var answer = System.Windows.MessageBox.Show("HAMANN.xml gefunden. \nZuletzt bearbeitet: " + File.GetLastWriteTime(file) + "\n\nSoll diese Datei verwendet werden, ohne eine neue aus den Einzeldokumenten zusammenzusetzen?",
// "Confirmation",
// MessageBoxButton.YesNo,
// MessageBoxImage.Question);
// if (answer == MessageBoxResult.Yes) return file;
File.Delete(file);
}
return new Concatinator(MakePath(XmlFileBox.Text)).HamannXmlFile;

View File

@@ -66,6 +66,7 @@ namespace HamannPrinter
public static StringBuilder LogString = new StringBuilder();
public static void Out(string str)
{
Console.WriteLine(str);
LogString.Append(str).Append(Environment.NewLine);
}
@@ -77,7 +78,7 @@ namespace HamannPrinter
DocOptions docOpt = new DocOptions(confix.Years, confix.OutputPath, confix.Editionsrichtlinien);
CheckXML(confix, docOpt, hamannDoc);
Coordinator(docOpt, hamannDoc, hamannDoc, docOpt.Years, confix.LettersDocx, confix.VolumeDocx, confix.RegisterDocx);
Helper.Ok("Fertig!");
// DEV Helper.Ok("Fertig!");
Environment.Exit(0);
}