processWordFile method

Future<void> processWordFile(
  1. ArchiveFile wordFile,
  2. int elementDepth,
  3. List<Relationship> relationShips,
  4. String wordOutputDirectory,
  5. List<Styles> stylesList,
  6. Document wordDocument,
  7. String fileType,
)

Function for processing .docx file

Implementation

Future<void> processWordFile(ArchiveFile wordFile, int elementDepth, List<Relationship> relationShips, String wordOutputDirectory,
    List<Styles> stylesList, Document wordDocument, String fileType) async {
  final fileContent = utf8.decode(wordFile.content);
  final document = xml.XmlDocument.parse(fileContent);
  var chkBody = document.findAllElements("w:body");
  if (chkBody.isNotEmpty) {
    for (var childElements in chkBody.first.childElements) {
      await processWordElements(childElements, elementDepth, relationShips, wordOutputDirectory, stylesList, wordDocument, fileType);
    }
  }
}