Sorry
i have more add this you can see this
In the above code, the RemoveLineItems method takes the file path of the Word document as input and opens it Pay My Doctor using the Open XML SDK. It iterates through each paragraph in the document and checks if it contains the text "Line Item". If it does, the paragraph is removed.
Please note that this is a basic example, and you may need to modify the code based on the structure and formatting of your specific Word document. Additionally, make sure to add the necessary references to the Open XML SDK in your project.
Hello ,
To remove line items from a Word report programmatically, you can use the Microsoft Office Open XML SDK.
sample code snippet in C# that demonstrates how to remove line items from a Word document:
write this code :
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
public void RemoveLineItems(string filePath)
{
using (WordprocessingDocument document = WordprocessingDocument.Open(filePath, true))
{
// Get the main document part
MainDocumentPart mainPart = document.MainDocumentPart;
// Get all paragraphs in the document
var paragraphs = mainPart.Document.Body.Descendants<Paragraph>();
foreach (var paragraph in paragraphs)
{
// Check if the paragraph contains line item content
if (paragraph.InnerText.Contains("Line Item"))
{
// Remove the paragraph
paragraph.Remove();
}
}
// Save the changes
mainPart.Document.Save();
}
}
if any issue to contant me , i will help you
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.