本文整理汇总了C#中DocumentBuilder.EndRow方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentBuilder.EndRow方法的具体用法?C# DocumentBuilder.EndRow怎么用?C# DocumentBuilder.EndRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentBuilder
的用法示例。
在下文中一共展示了DocumentBuilder.EndRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HorizontalMerge
public void HorizontalMerge()
{
//ExStart
//ExFor:CellMerge
//ExFor:CellFormat.HorizontalMerge
//ExId:HorizontalMerge
//ExSummary:Creates a table with two rows with cells in the first row horizontally merged.
Aspose.Words.Document doc = new Aspose.Words.Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertCell();
builder.CellFormat.HorizontalMerge = CellMerge.First;
builder.Write("Text in merged cells.");
builder.InsertCell();
// This cell is merged to the previous and should be empty.
builder.CellFormat.HorizontalMerge = CellMerge.Previous;
builder.EndRow();
builder.InsertCell();
builder.CellFormat.HorizontalMerge = CellMerge.None;
builder.Write("Text in one cell.");
builder.InsertCell();
builder.Write("Text in another cell.");
builder.EndRow();
builder.EndTable();
//ExEnd
}
示例2: VerticalMerge
public void VerticalMerge()
{
//ExStart
//ExFor:DocumentBuilder.InsertCell
//ExFor:DocumentBuilder.EndRow
//ExFor:CellMerge
//ExFor:CellFormat.VerticalMerge
//ExId:VerticalMerge
//ExSummary:Creates a table with two columns with cells merged vertically in the first column.
Aspose.Words.Document doc = new Aspose.Words.Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertCell();
builder.CellFormat.VerticalMerge = CellMerge.First;
builder.Write("Text in merged cells.");
builder.InsertCell();
builder.CellFormat.VerticalMerge = CellMerge.None;
builder.Write("Text in one cell");
builder.EndRow();
builder.InsertCell();
// This cell is vertically merged to the cell above and should be empty.
builder.CellFormat.VerticalMerge = CellMerge.Previous;
builder.InsertCell();
builder.CellFormat.VerticalMerge = CellMerge.None;
builder.Write("Text in another cell");
builder.EndRow();
builder.EndTable();
//ExEnd
}
示例3: Main
static void Main(string[] args)
{
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// We call this method to start building the table.
builder.StartTable();
builder.InsertCell();
builder.Write("Row 1, Cell 1 Content.");
// Build the second cell
builder.InsertCell();
builder.Write("Row 1, Cell 2 Content.");
// Call the following method to end the row and start a new row.
builder.EndRow();
// Build the first cell of the second row.
builder.InsertCell();
builder.Write("Row 2, Cell 1 Content");
// Build the second cell.
builder.InsertCell();
builder.Write("Row 2, Cell 2 Content.");
builder.EndRow();
// Signal that we have finished building the table.
builder.EndTable();
// Save the document to disk.
doc.Save("DocumentBuilder.CreateSimpleTable Out.doc");
}
示例4: VerticalMerge
// ExEnd:PrintCellMergeType
public static void VerticalMerge( string dataDir)
{
// ExStart:VerticalMerge
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertCell();
builder.CellFormat.VerticalMerge = CellMerge.First;
builder.Write("Text in merged cells.");
builder.InsertCell();
builder.CellFormat.VerticalMerge = CellMerge.None;
builder.Write("Text in one cell");
builder.EndRow();
builder.InsertCell();
// This cell is vertically merged to the cell above and should be empty.
builder.CellFormat.VerticalMerge = CellMerge.Previous;
builder.InsertCell();
builder.CellFormat.VerticalMerge = CellMerge.None;
builder.Write("Text in another cell");
builder.EndRow();
builder.EndTable();
dataDir = dataDir + "Table.VerticalMerge_out.doc";
// Save the document to disk.
doc.Save(dataDir);
// ExEnd:VerticalMerge
Console.WriteLine("\nTable created successfully with two columns with cells merged vertically in the first column.\nFile saved at " + dataDir);
}
示例5: SimpleTable
private static void SimpleTable(string dataDir)
{
// ExStart:SimpleTable
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// We call this method to start building the table.
builder.StartTable();
builder.InsertCell();
builder.Write("Row 1, Cell 1 Content.");
// Build the second cell
builder.InsertCell();
builder.Write("Row 1, Cell 2 Content.");
// Call the following method to end the row and start a new row.
builder.EndRow();
// Build the first cell of the second row.
builder.InsertCell();
builder.Write("Row 2, Cell 1 Content");
// Build the second cell.
builder.InsertCell();
builder.Write("Row 2, Cell 2 Content.");
builder.EndRow();
// Signal that we have finished building the table.
builder.EndTable();
dataDir = dataDir + "DocumentBuilder.CreateSimpleTable_out.doc";
// Save the document to disk.
doc.Save(dataDir);
// ExEnd:SimpleTable
Console.WriteLine("\nSimple table created successfully.\nFile saved at " + dataDir);
}
示例6: BuildTableWithStyle
/// <summary>
/// Shows how to build a new table with a table style applied.
/// </summary>
private static void BuildTableWithStyle(string dataDir)
{
// ExStart:BuildTableWithStyle
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = builder.StartTable();
// We must insert at least one row first before setting any table formatting.
builder.InsertCell();
// Set the table style used based of the unique style identifier.
// Note that not all table styles are available when saving as .doc format.
table.StyleIdentifier = StyleIdentifier.MediumShading1Accent1;
// Apply which features should be formatted by the style.
table.StyleOptions = TableStyleOptions.FirstColumn | TableStyleOptions.RowBands | TableStyleOptions.FirstRow;
table.AutoFit(AutoFitBehavior.AutoFitToContents);
// Continue with building the table as normal.
builder.Writeln("Item");
builder.CellFormat.RightPadding = 40;
builder.InsertCell();
builder.Writeln("Quantity (kg)");
builder.EndRow();
builder.InsertCell();
builder.Writeln("Apples");
builder.InsertCell();
builder.Writeln("20");
builder.EndRow();
builder.InsertCell();
builder.Writeln("Bananas");
builder.InsertCell();
builder.Writeln("40");
builder.EndRow();
builder.InsertCell();
builder.Writeln("Carrots");
builder.InsertCell();
builder.Writeln("50");
builder.EndRow();
dataDir = dataDir + "DocumentBuilder.SetTableStyle_out.docx";
// Save the document to disk.
doc.Save(dataDir);
// ExEnd:BuildTableWithStyle
Console.WriteLine("\nTable created successfully with table style.\nFile saved at " + dataDir);
}
示例7: Run
public static void Run()
{
// ExStart:DocumentBuilderBuildTable
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_WorkingWithDocument();
// Initialize document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = builder.StartTable();
// Insert a cell
builder.InsertCell();
// Use fixed column widths.
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;
builder.Write("This is row 1 cell 1");
// Insert a cell
builder.InsertCell();
builder.Write("This is row 1 cell 2");
builder.EndRow();
// Insert a cell
builder.InsertCell();
// Apply new row formatting
builder.RowFormat.Height = 100;
builder.RowFormat.HeightRule = HeightRule.Exactly;
builder.CellFormat.Orientation = TextOrientation.Upward;
builder.Writeln("This is row 2 cell 1");
// Insert a cell
builder.InsertCell();
builder.CellFormat.Orientation = TextOrientation.Downward;
builder.Writeln("This is row 2 cell 2");
builder.EndRow();
builder.EndTable();
dataDir = dataDir + "DocumentBuilderBuildTable_out.doc";
doc.Save(dataDir);
// ExEnd:DocumentBuilderBuildTable
Console.WriteLine("\nTable build successfully using DocumentBuilder.\nFile saved at " + dataDir);
}
示例8: Main
static void Main(string[] args)
{
// Check for license and apply if exists
string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic";
if (File.Exists(licenseFile))
{
// Apply Aspose.Words API License
Aspose.Words.License license = new Aspose.Words.License();
// Place license file in Bin/Debug/ Folder
license.SetLicense("Aspose.Words.lic");
}
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Start building a the table.
builder.StartTable();
builder.InsertCell();
builder.Write("Row 1, Cell 1 Content");
// Build the second cell
builder.InsertCell();
builder.Write("Row 1, Cell 2 Content");
// End previous row and start new
builder.EndRow();
// Build the first cell of 2nd row
builder.InsertCell();
builder.Write("Row 2, Cell 1 Content");
builder.InsertCell();
builder.Write("Row 2, Cell 2 Content");
builder.EndRow();
// End the table
builder.EndTable();
Range range = doc.Sections[0].Range;
range.Delete();
String text = doc.Range.Text;
System.Console.WriteLine(text);
System.Console.ReadKey();
}
示例9: Run
public static void Run()
{
// ExStart:BookmarkTable
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_WorkingWithBookmarks();
// Create empty document
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = builder.StartTable();
// Insert a cell
builder.InsertCell();
// Start bookmark here after calling InsertCell
builder.StartBookmark("MyBookmark");
builder.Write("This is row 1 cell 1");
// Insert a cell
builder.InsertCell();
builder.Write("This is row 1 cell 2");
builder.EndRow();
// Insert a cell
builder.InsertCell();
builder.Writeln("This is row 2 cell 1");
// Insert a cell
builder.InsertCell();
builder.Writeln("This is row 2 cell 2");
builder.EndRow();
builder.EndTable();
// End of bookmark
builder.EndBookmark("MyBookmark");
dataDir = dataDir + "Bookmark.Table_out.doc";
doc.Save(dataDir);
// ExEnd:BookmarkTable
Console.WriteLine("\nTable bookmarked successfully.\nFile saved at " + dataDir);
}
示例10: Main
static void Main(string[] args)
{
// Check for license and apply if exists
string licenseFile = AppDomain.CurrentDomain.BaseDirectory + "Aspose.Words.lic";
if (File.Exists(licenseFile))
{
// Apply Aspose.Words API License
Aspose.Words.License license = new Aspose.Words.License();
// Place license file in Bin/Debug/ Folder
license.SetLicense("Aspose.Words.lic");
}
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = builder.StartTable();
builder.InsertCell();
// Set the borders for the entire table.
table.SetBorders(LineStyle.Single, 2.0, Color.Black);
// Set the cell shading for this cell.
builder.CellFormat.Shading.BackgroundPatternColor = Color.DarkGray;
builder.Writeln("Cell #1");
builder.InsertCell();
// Specify a different cell shading for the second cell.
builder.CellFormat.Shading.BackgroundPatternColor=Color.Blue;
builder.Writeln("Cell #2");
// End this row.
builder.EndRow();
// Clear the cell formatting from previous operations.
builder.CellFormat.ClearFormatting();
// Create the second row.
builder.InsertCell();
// Create larger borders for the first cell of this row. This will be different
// compared to the borders set for the table.
builder.CellFormat.Borders.Left.LineWidth=4.0;
builder.CellFormat.Borders.Right.LineWidth=4.0;
builder.CellFormat.Borders.Top.LineWidth=4.0;
builder.CellFormat.Borders.Bottom.LineWidth=4.0;
builder.Writeln("Cell #3");
builder.InsertCell();
// Clear the cell formatting from the previous cell.
builder.CellFormat.ClearFormatting();
builder.Writeln("Cell #4");
doc.Save("Format Table in Document.doc");
}
示例11: Run
public static void Run()
{
// ExStart:RepeatRowsOnSubsequentPages
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_WorkingWithTables();
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = builder.StartTable();
builder.RowFormat.HeadingFormat = true;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.CellFormat.Width = 100;
builder.InsertCell();
builder.Writeln("Heading row 1");
builder.EndRow();
builder.InsertCell();
builder.Writeln("Heading row 2");
builder.EndRow();
builder.CellFormat.Width = 50;
builder.ParagraphFormat.ClearFormatting();
// Insert some content so the table is long enough to continue onto the next page.
for (int i = 0; i < 50; i++)
{
builder.InsertCell();
builder.RowFormat.HeadingFormat = false;
builder.Write("Column 1 Text");
builder.InsertCell();
builder.Write("Column 2 Text");
builder.EndRow();
}
dataDir = dataDir + "Table.HeadingRow_out.doc";
// Save the document to disk.
doc.Save(dataDir);
// ExEnd:RepeatRowsOnSubsequentPages
Console.WriteLine("\nTable build successfully which include heading rows that repeat on subsequent pages..\nFile saved at " + dataDir);
}
示例12: Main
static void Main(string[] args)
{
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = builder.StartTable();
builder.InsertCell();
// Set the borders for the entire table.
table.SetBorders(LineStyle.Single, 2.0, Color.Black);
// Set the cell shading for this cell.
builder.CellFormat.Shading.BackgroundPatternColor = Color.DarkGray;
builder.Writeln("Cell #1");
builder.InsertCell();
// Specify a different cell shading for the second cell.
builder.CellFormat.Shading.BackgroundPatternColor=Color.Blue;
builder.Writeln("Cell #2");
// End this row.
builder.EndRow();
// Clear the cell formatting from previous operations.
builder.CellFormat.ClearFormatting();
// Create the second row.
builder.InsertCell();
// Create larger borders for the first cell of this row. This will be different
// compared to the borders set for the table.
builder.CellFormat.Borders.Left.LineWidth=4.0;
builder.CellFormat.Borders.Right.LineWidth=4.0;
builder.CellFormat.Borders.Top.LineWidth=4.0;
builder.CellFormat.Borders.Bottom.LineWidth=4.0;
builder.Writeln("Cell #3");
builder.InsertCell();
// Clear the cell formatting from the previous cell.
builder.CellFormat.ClearFormatting();
builder.Writeln("Cell #4");
doc.Save("data/Format Table in Document.doc");
}
示例13: Execute
protected override void Execute(CodeActivityContext executionContext)
{
// Get Values from the Input Parameters
bool Logging = EnableLogging.Get(executionContext);
string LicenseFilePath = LicenseFile.Get(executionContext);
string LogFilePath = LogFile.Get(executionContext);
int detectIn = DetectIn.Get(executionContext);
OutputAttachmentId.Set(executionContext, new EntityReference("annotation", Guid.Empty));
if (Logging)
Log("Execution Started", LogFilePath);
// Creating CRM service from Context
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
try
{
// Applying Licence for Aspose (If Exist)
if (Logging)
Log("Enable Licensing", LogFilePath);
if (LicenseFilePath != "" && File.Exists(LicenseFilePath))
{
License Lic = new License();
Lic.SetLicense(LicenseFilePath);
if (Logging)
Log("License Set", LogFilePath);
}
}
catch (Exception ex)
{
Log("Error while applying license: " + ex.Message, LogFilePath);
}
if (detectIn == 0) // under this record
{
Guid ThisRecordId = context.PrimaryEntityId;
string RecordType = context.PrimaryEntityName;
Document Result = new Document();
DocumentBuilder ResultWriter = new DocumentBuilder(Result);
if (Logging)
Log("Working under all attachments under this record", LogFilePath);
// Retrieve All attachments under this Record
QueryExpression RetrieveNoteQuery = new QueryExpression("annotation");
RetrieveNoteQuery.ColumnSet = new ColumnSet(new string[] { "filename", "subject", "documentbody" });
RetrieveNoteQuery.Criteria.AddCondition(new ConditionExpression("objectid", ConditionOperator.Equal, ThisRecordId));
if (Logging)
Log("Executing Query to retrieve All Notes within this record", LogFilePath);
EntityCollection Notes = service.RetrieveMultiple(RetrieveNoteQuery);
// Loop through All Notes
foreach (Entity Note in Notes.Entities)
{
try
{
if (Note.Contains("documentbody"))
{
string FileName = "";
if (Note.Contains("filename"))
FileName = Note["filename"].ToString();
// Read Attachment in Aspose
byte[] DocumentBody = Convert.FromBase64String(Note["documentbody"].ToString());
MemoryStream fileStream = new MemoryStream(DocumentBody);
Document doc = new Document(fileStream);
ResultWriter.Writeln("Comparing Document: " + FileName);
ResultWriter.StartTable();
// Comparing document with other attachments
foreach (Entity OtherNote in Notes.Entities)
{
if (OtherNote.Id != Note.Id)
{
if (OtherNote.Contains("documentbody"))
{
string OtherFileName = "";
if (OtherNote.Contains("filename"))
OtherFileName = OtherNote["filename"].ToString();
// Reading attachment in Aspose
byte[] OtherDocumentBody = Convert.FromBase64String(OtherNote["documentbody"].ToString());
MemoryStream fileStream2 = new MemoryStream(OtherDocumentBody);
Document doc2 = new Document(fileStream);
ResultWriter.InsertCell();
ResultWriter.Write(OtherFileName);
// Compare documents
doc.Compare(doc2, "a", DateTime.Now);
if (doc.Revisions.Count == 0)
{
// If documents are same
ResultWriter.InsertCell();
ResultWriter.Write("Duplicate Documents");
}
ResultWriter.EndRow();
}
}
}
ResultWriter.EndTable();
//.........这里部分代码省略.........
示例14: InsertTable
/// <summary>
/// Insert new table in the document
/// </summary>
private static void InsertTable(Document doc)
{
DocumentBuilder builder = new DocumentBuilder(doc);
//Start creating a new table
Table table = builder.StartTable();
//Insert Row 1 Cell 1
builder.InsertCell();
builder.Write("Date");
//Set width to fit the table contents
table.AutoFit(AutoFitBehavior.AutoFitToContents);
//Insert Row 1 Cell 2
builder.InsertCell();
builder.Write(" ");
builder.EndRow();
//Insert Row 2 Cell 1
builder.InsertCell();
builder.Write("Author");
//Insert Row 2 Cell 2
builder.InsertCell();
builder.Write(" ");
builder.EndRow();
builder.EndTable();
}
示例15: DocumentBuilderSetRowFormatting
public void DocumentBuilderSetRowFormatting()
{
//ExStart
//ExFor:DocumentBuilder.RowFormat
//ExFor:RowFormat.Height
//ExFor:RowFormat.HeightRule
//ExFor:Table.LeftPadding
//ExFor:Table.RightPadding
//ExFor:Table.TopPadding
//ExFor:Table.BottomPadding
//ExId:DocumentBuilderSetRowFormatting
//ExSummary:Shows how to create a table that contains a single cell and apply row formatting.
Aspose.Words.Document doc = new Aspose.Words.Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = builder.StartTable();
builder.InsertCell();
// Set the row formatting
RowFormat rowFormat = builder.RowFormat;
rowFormat.Height = 100;
rowFormat.HeightRule = HeightRule.Exactly;
// These formatting properties are set on the table and are applied to all rows in the table.
table.LeftPadding = 30;
table.RightPadding = 30;
table.TopPadding = 30;
table.BottomPadding = 30;
builder.Writeln("I'm a wonderful formatted row.");
builder.EndRow();
builder.EndTable();
//ExEnd
}