本文整理汇总了C#中Paragraph.Append方法的典型用法代码示例。如果您正苦于以下问题:C# Paragraph.Append方法的具体用法?C# Paragraph.Append怎么用?C# Paragraph.Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paragraph
的用法示例。
在下文中一共展示了Paragraph.Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateStepParagraph
public static Paragraph GenerateStepParagraph(Step step)
{
// HACK - We need to generate a custom paragraph here because 2 Run objects are needed to allow for the bolded keyword
var paragraph = new Paragraph(new ParagraphProperties(new ParagraphStyleId { Val = "Normal" }));
// Add comments before step
if (step.Comments.Any(o => o.Type == CommentType.StepComment))
{
foreach (var comment in step.Comments.Where(o => o.Type == CommentType.StepComment))
{
paragraph.Append(new Run(new RunProperties(new Italic()), new Text(comment.Text)));
paragraph.Append(new Break());
}
}
// Add step
paragraph.Append(new Run(new RunProperties(new Bold()), new Text(step.NativeKeyword)));
var nameText = new Text { Space = SpaceProcessingModeValues.Preserve };
nameText.Text = " " + step.Name;
paragraph.Append(new Run(nameText));
// Add comments after step
if (step.Comments.Any(o => o.Type == CommentType.AfterLastStepComment))
{
paragraph.Append(new Break());
foreach (var comment in step.Comments.Where(o => o.Type == CommentType.AfterLastStepComment))
{
paragraph.Append(new Run(new RunProperties(new Italic()), new Text(comment.Text)));
paragraph.Append(new Break());
}
}
return paragraph;
}
示例2: GenerateParagraph
public static void GenerateParagraph(this Body body, string text, string styleId)
{
var paragraph = new Paragraph
{
RsidParagraphAddition = "00CC1B7A",
RsidParagraphProperties = "0016335E",
RsidRunAdditionDefault = "0016335E"
};
var paragraphProperties = new ParagraphProperties();
var paragraphStyleId = new ParagraphStyleId {Val = styleId};
paragraphProperties.Append(paragraphStyleId);
var run1 = new Run();
var text1 = new Text();
text1.Text = text;
run1.Append(text1);
paragraph.Append(paragraphProperties);
paragraph.Append(run1);
body.Append(paragraph);
}
示例3: Format
public void Format(Body body, Step step)
{
// HACK - We need to generate a custom paragraph here because 2 Run objects are needed to allow for the bolded keyword
var paragraph = new Paragraph(new ParagraphProperties(new ParagraphStyleId {Val = "Normal"}));
paragraph.Append(new Run(new RunProperties(new Bold()), new Text(step.NativeKeyword)));
var nameText = new Text {Space = SpaceProcessingModeValues.Preserve};
nameText.Text = " " + step.Name;
paragraph.Append(new Run(nameText));
body.Append(paragraph);
if (!string.IsNullOrEmpty(step.DocStringArgument))
{
string[] lines = step.DocStringArgument.Split(new[] {Environment.NewLine},
StringSplitOptions.RemoveEmptyEntries);
foreach (string line in lines)
{
body.GenerateParagraph(line, "Quote");
}
}
if (step.TableArgument != null)
{
this.wordTableFormatter.Format(body, step.TableArgument);
}
}
示例4: ApplyFooter
private void ApplyFooter(FooterPart footerPart)
{
var footer1 = new Footer();
footer1.AddNamespaceDeclaration("ve", "http://schemas.openxmlformats.org/markup-compatibility/2006");
footer1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
footer1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
footer1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
footer1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
footer1.AddNamespaceDeclaration("wp",
"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
footer1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
footer1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
footer1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
var paragraph1 = new Paragraph {RsidParagraphAddition = "005641D2", RsidRunAdditionDefault = "005641D2"};
var paragraphProperties1 = new ParagraphProperties();
var paragraphStyleId1 = new ParagraphStyleId {Val = "Footer"};
paragraphProperties1.Append(paragraphStyleId1);
var run1 = new Run();
var text1 = new Text();
text1.Text = "Generated with Pickles " + Assembly.GetExecutingAssembly().GetName().Version;
run1.Append(text1);
paragraph1.Append(paragraphProperties1);
paragraph1.Append(run1);
footer1.Append(paragraph1);
footerPart.Footer = footer1;
}
示例5: GenerateStepParagraph
public static Paragraph GenerateStepParagraph(Step step)
{
// HACK - We need to generate a custom paragraph here because 2 Run objects are needed to allow for the bolded keyword
var paragraph = new Paragraph(new ParagraphProperties(new ParagraphStyleId { Val = "Normal" }));
paragraph.Append(new Run(new RunProperties(new Bold()), new Text(step.NativeKeyword)));
var nameText = new Text { Space = SpaceProcessingModeValues.Preserve };
nameText.Text = " " + step.Name;
paragraph.Append(new Run(nameText));
return paragraph;
}
示例6: GenerateParagraph
/// <summary>
/// создание параграфа
/// </summary>
/// <param name="text">null = пустая строка</param>
/// <param name="parProp">null = настройки из стиля</param>
/// <returns></returns>
public void GenerateParagraph(Run run = null, ParagraphProperties parProp = null)
{
var paragraph = new Paragraph();
parProp = parProp ?? GetParagraphProperties();
paragraph.Append(parProp);
if (run != null)
{
paragraph.Append(run);
}
_body.Append(paragraph);
}
示例7: AddIndexMark
public static void AddIndexMark(Paragraph paragraph, string text, string sortText)
{
if (sortText != null && sortText != "" && sortText != text)
text = text + ";" + sortText;
else if (text.StartsWith("The "))
text = text.Substring(4) + ", The";
paragraph.Append(new Run(new FieldChar { FieldCharType = FieldCharValues.Begin }));
paragraph.Append(new Run(new FieldCode { Space = SpaceProcessingModeValues.Preserve, Text = " XE \"" }));
// paragraph.Append(new Run(new FieldCode { Text = text }) { RsidRunProperties = "00D03062" });
paragraph.Append(new Run(new FieldCode { Text = text }));
paragraph.Append(new Run(new FieldCode { Space = SpaceProcessingModeValues.Preserve, Text = "\" " }));
paragraph.Append(new Run(new FieldChar() { FieldCharType = FieldCharValues.End }));
}
示例8: saveDOC
//Main class function, export the mutationList to DOCX file, sets file name to patient's testName.
public static void saveDOC(Patient patient, List<Mutation> mutationList, bool includePersonalDetails)
{
WordprocessingDocument myDoc = null;
string fullPath = Properties.Settings.Default.ExportSavePath + @"\" + patient.TestName;
if (includePersonalDetails)
fullPath += "_withDetails";
fullPath += ".docx";
try
{
myDoc = WordprocessingDocument.Create(fullPath, WordprocessingDocumentType.Document);
}
catch(IOException )
{
throw ;
}
MainDocumentPart mainPart = myDoc.AddMainDocumentPart();
mainPart.Document = new Document();
Body body = new Body();
Paragraph paragraph = new Paragraph();
Run run_paragraph = new Run();
paragraph.Append(run_paragraph);
//add paragraph for each detail of the patient.
body.Append(generateParagraph("Test Name",true));
body.Append(generateParagraph(patient.TestName,false));
//add personal details of the patien, if includePersonalDetails=true
if (includePersonalDetails)
{
body.Append(generateParagraph("ID", true));
body.Append(generateParagraph(patient.PatientID, false));
body.Append(generateParagraph("First Name", true));
body.Append(generateParagraph(patient.FName, false));
body.Append(generateParagraph("Last Name", true));
body.Append(generateParagraph(patient.LName, false));
}
body.Append(generateParagraph("Pathological Number", true));
body.Append(generateParagraph(patient.PathoNum, false));
body.Append(generateParagraph("Run Number", true));
body.Append(generateParagraph(patient.RunNum, false));
body.Append(generateParagraph("Tumour Site", true));
body.Append(generateParagraph(patient.TumourSite, false));
body.Append(generateParagraph("Disease Level", true));
body.Append(generateParagraph(patient.DiseaseLevel, false));
body.Append(generateParagraph("Backgroud", true));
body.Append(generateParagraph(patient.Background, false));
body.Append(generateParagraph("Previous Treatment", true));
body.Append(generateParagraph(patient.PrevTreatment, false));
body.Append(generateParagraph("Current Treatment", true));
body.Append(generateParagraph(patient.CurrTreatment, false));
body.Append(generateParagraph("Conclusion", true));
body.Append(generateParagraph(patient.Conclusion, false));
//Add related mutation of the patient.
CreateTable(body, mutationList);
mainPart.Document.Append(body);
mainPart.Document.Save();
myDoc.Close();
}
示例9: Format
public void Format(Body body, Scenario background)
{
var headerParagraph = new Paragraph(new ParagraphProperties(new ParagraphStyleId { Val = "Heading2" }));
var backgroundKeyword = GetLocalizedBackgroundKeyword();
headerParagraph.Append(new Run(new RunProperties(new Bold()), new Text(backgroundKeyword)));
var table = new Table();
table.Append(GenerateTableProperties());
var row = new TableRow();
var cell = new TableCell();
cell.Append(headerParagraph);
foreach (var descriptionSentence in WordDescriptionFormatter.SplitDescription(background.Description))
{
cell.Append(CreateNormalParagraph(descriptionSentence));
}
foreach (var step in background.Steps)
{
cell.Append(WordStepFormatter.GenerateStepParagraph(step));
if (step.TableArgument != null)
{
cell.Append(this.wordTableFormatter.CreateWordTableFromPicklesTable(step.TableArgument));
}
}
cell.Append(CreateNormalParagraph("")); // Is there a better way to generate a new empty line?
row.Append(cell);
table.Append(row);
body.Append(table);
}
示例10: GenerateParagraph
/// <summary>
/// Generates the paragraph.
/// </summary>
/// <returns>
/// Returns new Paragraph with empty run
/// </returns>
public static Paragraph GenerateParagraph()
{
var paragraph = new Paragraph();
var run = new Run();
paragraph.Append(run);
return paragraph;
}
示例11: AddAlphaRow
public Paragraph AddAlphaRow()
{
var paragraph1 = new Paragraph {RsidParagraphMarkRevision = "005205ED", RsidParagraphAddition = "00A01149", RsidParagraphProperties = "005205ED", RsidRunAdditionDefault = "00E7001C"};
var paragraphProperties1 = new ParagraphProperties();
var spacingBetweenLines1 = new SpacingBetweenLines {After = "60", Line = "240", LineRule = LineSpacingRuleValues.Auto};
var justification1 = new Justification {Val = JustificationValues.Center};
var paragraphMarkRunProperties1 = new ParagraphMarkRunProperties();
var runFonts1 = new RunFonts {ComplexScriptTheme = ThemeFontValues.MinorHighAnsi};
var bold1 = new Bold();
var fontSize1 = new FontSize {Val = "32"};
var fontSizeComplexScript1 = new FontSizeComplexScript {Val = "32"};
paragraphMarkRunProperties1.Append(runFonts1);
paragraphMarkRunProperties1.Append(bold1);
paragraphMarkRunProperties1.Append(fontSize1);
paragraphMarkRunProperties1.Append(fontSizeComplexScript1);
paragraphProperties1.Append(new KeepNext());
paragraphProperties1.Append(spacingBetweenLines1);
paragraphProperties1.Append(justification1);
paragraphProperties1.Append(paragraphMarkRunProperties1);
var run1 = new Run {RsidRunProperties = "005205ED"};
var runProperties1 = new RunProperties();
var runFonts2 = new RunFonts {ComplexScriptTheme = ThemeFontValues.MinorHighAnsi};
var bold2 = new Bold();
var fontSize2 = new FontSize {Val = "32"};
var fontSizeComplexScript2 = new FontSizeComplexScript {Val = "32"};
runProperties1.Append(runFonts2);
runProperties1.Append(bold2);
runProperties1.Append(fontSize2);
runProperties1.Append(fontSizeComplexScript2);
var text1 = new Text();
text1.Text = FamilyName.Substring(0, 1);
run1.Append(runProperties1);
run1.Append(text1);
paragraph1.Append(paragraphProperties1);
paragraph1.Append(run1);
return paragraph1;
}
示例12: GenerateHeaderPartContent
private static void GenerateHeaderPartContent(HeaderPart part)
{
Header header1 = new Header() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 wp14" } };
header1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
header1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
header1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
header1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
header1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
header1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
header1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
header1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
header1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
header1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
header1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
header1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
header1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
header1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
header1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
Paragraph paragraph1 = new Paragraph() { RsidParagraphAddition = "00164C17", RsidRunAdditionDefault = "00164C17" };
ParagraphProperties paragraphProperties1 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId1 = new ParagraphStyleId() { Val = "Header" };
paragraphProperties1.Append(paragraphStyleId1);
Run run1 = new Run();
DocumentFormat.OpenXml.Wordprocessing.Text text1 = new DocumentFormat.OpenXml.Wordprocessing.Text();
text1.Text = "Header";
run1.Append(text1);
paragraph1.Append(paragraphProperties1);
paragraph1.Append(run1);
header1.Append(paragraph1);
part.Header = header1;
}
示例13: ToOpenXmlElements
public override IEnumerable<OpenXmlElement> ToOpenXmlElements(DocumentFormat.OpenXml.Packaging.MainDocumentPart mainDocumentPart)
{
TableCell result = new TableCell();
var cellProperties = new TableCellProperties();
if (!Width.IsEmpty)
{
var cellWidth = UnitHelper.Convert(Width).To<TableCellWidth>();
cellProperties.Append(cellWidth);
}
if (Colspan.HasValue)
{
var gridSpan = new GridSpan() { Val = Colspan };
cellProperties.Append(gridSpan);
}
result.Append(cellProperties);
var paraContent = new Paragraph();
ForEachChild(x =>
{
if (x is TextFormattedElement)
{
paraContent.Append(
new Run(x.ToOpenXmlElements(mainDocumentPart))
);
}
else
{
paraContent.Append(x.ToOpenXmlElements(mainDocumentPart));
}
});
result.Append(paraContent);
return new List<OpenXmlElement> { result };
}
示例14: AddHeaderRow
private static void AddHeaderRow(DataTable table, Table wordTable, TableStyle tableStyle)
{
// Create a row.
TableRow tRow = new TableRow();
foreach (DataColumn iColumn in table.Columns) {
// Create a cell.
TableCell tCell = new TableCell();
TableCellProperties tCellProperties = new TableCellProperties();
// Set Cell Color
Shading tCellColor = new Shading() { Val = ShadingPatternValues.Clear, Color = "auto", Fill = System.Drawing.ColorTranslator.ToHtml(tableStyle.HeaderBackgroundColor) };
tCellProperties.Append(tCellColor);
// Append properties to the cell
tCell.Append(tCellProperties);
ParagraphProperties paragProperties = new ParagraphProperties();
Justification justification1 = new Justification() { Val = JustificationValues.Center };
SpacingBetweenLines spacingBetweenLines1 = new SpacingBetweenLines() { After = "0" };
paragProperties.Append(spacingBetweenLines1);
paragProperties.Append(justification1);
var parag = new Paragraph();
parag.Append(paragProperties);
var run = new Run(new Text(iColumn.ColumnName));
ApplyFontProperties(tableStyle, RowIdentification.Header, run);
parag.Append(run);
// Specify the table cell content.
tCell.Append(parag);
// Append the table cell to the table row.
tRow.Append(tCell);
}
// Append the table row to the table.
wordTable.Append(tRow);
}
示例15: AddSpacerCell
// Creates an TableCell instance and adds its children.
public static void AddSpacerCell(this TableRow row, string width = "173")
{
TableCell tableCell1 = new TableCell();
TableCellProperties tableCellProperties1 = new TableCellProperties();
TableCellWidth tableCellWidth1 = new TableCellWidth() { Width = width, Type = TableWidthUnitValues.Dxa };
tableCellProperties1.Append(tableCellWidth1);
Paragraph paragraph1 = new Paragraph() { RsidParagraphAddition = "005A43FA", RsidParagraphProperties = "005A43FA", RsidRunAdditionDefault = "005A43FA" };
ParagraphProperties paragraphProperties1 = new ParagraphProperties();
Indentation indentation1 = new Indentation() { Left = "95", Right = "95" };
paragraphProperties1.Append(indentation1);
paragraph1.Append(paragraphProperties1);
tableCell1.Append(tableCellProperties1);
tableCell1.Append(paragraph1);
row.Append(tableCell1);
}