private static void PrintBehavior(Model.Core.Behavior behaviorToPrint, bool draft) { _log.Info("Print Controller printing Behavior: " + behaviorToPrint.Artifact.Name); var trimName = behaviorToPrint.Artifact.Name.Replace(" ", "-").ToLower(); _outputFolder = ModelMap.FilePath + ModelMap.BehaviorFolder + ModelMap.FolderSeparator + trimName + ModelMap.FolderSeparator + ModelMap.Latest; _filePath = _outputFolder + ModelMap.FolderSeparator + trimName + ".docx"; try { Directory.CreateDirectory(_outputFolder); InitWorkingDocument(ModelMap.StyleSource); } catch (Exception ex) { _log.Error("Artifact Output Folder: " + _outputFolder + " cannot be created."); _log.Error(ex); return; } BehaviorPrinter.PrintBehavior(_document, behaviorToPrint, false); Utils.InsertCustomWatermark(_document, draft ? ModelMap.DraftWaterMark : ModelMap.WaterMark); Utils.AddFooter(_document, behaviorToPrint.Artifact.Name); Save(); }
public static void PrintBehavior(WordprocessingDocument document, Model.Core.Behavior behavior, bool book, bool isForAppendix = false) { ArtifactPrinter.AddArtifactContent(document, behavior.Artifact, book, isForAppendix); _log.Info("Printing Behavior Properties: " + behavior.Artifact.Name); var body = document.MainDocumentPart.Document.Body; var aDef = body.AppendChild(new Paragraph()); var adRun = aDef.AppendChild(new Run()); adRun.AppendChild(new Text("Behavior Details")); Utils.ApplyStyleToParagraph(document, "Heading1", "Heading1", aDef, JustificationValues.Center); var basicProps = new[, ] { { "Is External:", behavior.IsExternal.ToString() }, { "Constructor:", behavior.ConstructorType } }; Utils.AddTable(document, basicProps); //"PlainTable3" CommonPrinter.BuildInvocationsTable(document, behavior.Invocations); if (behavior.Properties.Any()) { CommonPrinter.BuildPropertiesTable(document, behavior.Properties, book); } }