本文整理汇总了C#中DocumentBuilder.InsertParagraph方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentBuilder.InsertParagraph方法的具体用法?C# DocumentBuilder.InsertParagraph怎么用?C# DocumentBuilder.InsertParagraph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentBuilder
的用法示例。
在下文中一共展示了DocumentBuilder.InsertParagraph方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildBookingTable
public void BuildBookingTable(DocumentBuilder builder)
{
//Reset to default font and paragraph formatting.
builder.Font.ClearFormatting();
builder.ParagraphFormat.ClearFormatting();
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.InsertParagraph();
builder.Writeln(confirmationLabel.Text);
builder.Font.Color = System.Drawing.Color.Black;
builder.Font.Size = 10;
builder.Font.Name = "Tahoma";
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;
BorderCollection borders = builder.CellFormat.Borders;
borders.LineStyle = LineStyle.Single;
borders.Color = System.Drawing.Color.Black;
builder.StartTable();
builder.Font.Bold = true;
builder.InsertCell();
builder.Write(GetMessage("flightNumber"));
builder.CellFormat.Shading.BackgroundPatternColor = System.Drawing.Color.LightGray;
builder.InsertCell();
builder.Write(GetMessage("departureDate"));
builder.CellFormat.Shading.BackgroundPatternColor = System.Drawing.Color.LightGray;
builder.InsertCell();
builder.Write(GetMessage("departureAirport"));
builder.CellFormat.Shading.BackgroundPatternColor = System.Drawing.Color.LightGray;
builder.InsertCell();
builder.Write(GetMessage("destinationAirport"));
builder.CellFormat.Shading.BackgroundPatternColor = System.Drawing.Color.LightGray;
builder.InsertCell();
builder.Write(GetMessage("aircraft"));
builder.CellFormat.Shading.BackgroundPatternColor = System.Drawing.Color.LightGray;
builder.EndRow();
builder.CellFormat.ClearFormatting();
builder.Font.ClearFormatting();
foreach (Flight flight in confirmation.Reservation.Itinerary.Flights)
{
builder.InsertCell();
builder.Write(flight.FlightNumber);
builder.InsertCell();
builder.Write(flight.DepartureTime.ToString());
builder.InsertCell();
builder.Write(flight.DepartureAirport.Description);
builder.InsertCell();
builder.Write(flight.DestinationAirport.Description);
builder.InsertCell();
builder.Write(flight.Aircraft.Model);
builder.EndRow();
}
builder.EndTable();
}
示例2: AddsParagraphsToBody_WhenStartVisitingFromSection
public void AddsParagraphsToBody_WhenStartVisitingFromSection()
{
var builder = new DocumentBuilder();
builder.InsertParagraph();
Section section = builder.Document.FirstSection;
var bodyProxy = new BodyProxy();
var firstParagraph = A.Fake<ParagraphProxy>();
var secondParagraph = A.Fake<ParagraphProxy>();
A.CallTo(() => this.proxyFactory.CreateBody()).Returns(bodyProxy);
A.CallTo(() => this.proxyFactory.CreateParagraph()).ReturnsNextFromSequence(firstParagraph, secondParagraph);
section.Accept(this.testee);
bodyProxy.Children.Should().HaveCount(2)
.And.ContainInOrder(firstParagraph, secondParagraph);
}
示例3: GenerateOutPutDocument
protected void GenerateOutPutDocument(string outFileName)
{
//Open the template document
Document doc = new Document(Server.MapPath("~/App_Data/DocumentBuilderDemo.docx"));
//Once the builder is created, its cursor is positioned at the beginning of the document.
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
BarCodeBuilder barCode = CreateBarCode();
builder.InsertImage(barCode.BarCodeImage);
builder.MoveToDocumentStart();
System.Drawing.Image image = System.Drawing.Image.FromFile(Server.MapPath("~/Web/Images/spring-air-logo-header.jpg"));
builder.InsertImage(image);
builder.InsertParagraph();
builder.ParagraphFormat.ClearFormatting();
builder.Font.ClearFormatting();
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.ParagraphFormat.Shading.ForegroundPatternColor = System.Drawing.Color.White;
builder.ParagraphFormat.Shading.Texture = TextureIndex.TextureSolid;
builder.ParagraphFormat.LeftIndent = ConvertUtil.InchToPoint(0.3);
builder.ParagraphFormat.SpaceBefore = 12;
builder.ParagraphFormat.SpaceAfter = 12;
builder.Font.Name = "Arial";
builder.Font.Size = 9;
builder.Write("ELECTRONIC TICKET - PASSENGER ITINERARY/RECEIPT");
builder.InsertBreak(BreakType.LineBreak);
builder.Writeln("CUSTOMER COPY - Powered by ASPOSE");
builder.ParagraphFormat.ClearFormatting();
builder.InsertHtml("<hr>");
BuildBookingTable(builder);
builder.MoveToDocumentEnd();
builder.InsertBreak(BreakType.LineBreak);
builder.InsertHtml("<hr>");
builder.InsertParagraph();
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.InsertImage(barCode.BarCodeImage);
doc.Save(Response, outFileName, ContentDisposition.Inline, null);
Response.End();
}