We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Borderless table

Hello.

How do I create a table without borders using Aspose.Words? Currently when my document prints, the tables have borders. I have a strict client with very specific requirements that include no borders, however I need to display data in sections of my document that must contain columns and rows.

I appreciate your assistance,
/Davis
Hi Davis,

Thanks for your inquiry. Please use Table.ClearBorders method to remove all table and cell borders on this table. Please check following code example for your kind reference. Hope this helps you.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

Table table = builder.StartTable();

// Insert a cell

builder.InsertCell();

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();

table.ClearBorders();

doc.Save(MyDir + "Out.docx");

Hello,

One quick question how do I find the page that a certain text shows up on? For example, my document has markers on them i.e. "**Marker1***","**Marker2***" and "**Marker3***". How do I get the page numbers of each marker into a .NET c# variable?

Thank you,
Hi Davis,

Thanks for your inquiry. Please read following article about find and replace text.
Find and Replace Overview

We suggest you please implement IReplacingCallback interface and use LayoutCollector.GetEndPageIndex method to get 1-based index of the page where node begins. Please check following code example for your kind reference. Hope this helps you.

private class MyReplaceEvaluator : IReplacingCallback

{

ReplaceAction IReplacingCallback.Replacing(ReplacingArgs e)

{

LayoutCollector collector = new LayoutCollector((Document)e.MatchNode.Document);

Console.WriteLine(collector.GetStartPageIndex(e.MatchNode.ParentNode));

return ReplaceAction.Skip;

}

}

Document doc = new Document(MyDir + "in.docx");

Regex regex = new Regex("\*\*Marker1\*\*", RegexOptions.IgnoreCase);

doc.Range.Replace(regex, new MyReplaceEvaluator(), false);