Get text from DOCX

2 posts, 0 answers
  1. Manjinder
    Manjinder avatar
    1 posts
    Member since:
    Jul 2015

    Posted 20 Jul Link to this post

    Are you able to open a DOCX and return the text from the document into a string. I need to be able to parse through the string to determine text replacements to be made. I can see methods for replacing text, but not for determining what text a document contains

    Regards

  2. Boby
    Admin
    Boby avatar
    627 posts

    Posted 24 Jul Link to this post

    Hi Manjinder,

    To extract the text, you can import the document using the DocxFormatProvider and export it as plain text using the TextFormatProvider:
    DocxFormatProvider docxFormatProvider = new DocxFormatProvider();
    RadFlowDocument document = docxFormatProvider.Import(str);
    TxtFormatProvider txtFormatProvider = new TxtFormatProvider();
    string text = txtFormatProvider.Export(document);


    Regards,
    Boby
    Progress Telerik

Back to Top