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

Free Support Forum - aspose.com

Can we get Paragraph Clause/ Title from Paragraph? Is there any property to do?

Can we get Paragraph clause/ Title from Paragraph? Is there any property to do?

@Deepali_Shirude Could you please provide the test document and what do you expect to get so we could elaborate your request?

Hi,

Please see below example.

Optional Extension. If there is an option to extend this agreement and the Purchaser wishes to exercise it, the Purchaser shall notify the Supplier in writing of its intention to extend the performance term at least thirty (30) days before the Expiry Date, and shall amend the Agreement before the Expiry Date. The preliminary notice does not commit the Purchaser to an extension. The extension shall be by mutual agreement evidenced by a written amendment to this Agreement.

In this Paragraph, Optional Extension is clause. So want to extract that from Paragraph collection.

Attached is the document for reference.Master-Service-Agreement-Sample.docx (46.6 KB)

@Deepali_Shirude Unfortunately in your document the paragraph clause is not delimited in the document model. It could be detected only by bold style. Here is an code example how you could get the clause from “Optional Extension…” paragraph. Note that it may be required to modify the code for other cases in your document.

Paragraph para = (Paragraph)doc.FirstSection.Body.GetChild(NodeType.Paragraph, 10, false); // "2. 	Optional Extension..." it 10th paragraph.
var runs = para.Runs.TakeWhile(r => ((Run)r).Font.Bold).ToList(); // Take first runs with Bold style.
runs.RemoveRange(0, 3); // First 3 runs are list label, space and tab.
runs.RemoveRange(runs.Count - 2, 2); // Last 2 runs are dot and space.
string clauseText = string.Join("", runs.Select(r => r.GetText()));