Hi team,
Getting below mentioned exception while using document.extractPages().
class com.aspose.words.StructuredDocumentTag cannot be cast to class com.aspose.words.Table (com.aspose.words.StructuredDocumentTag and com.aspose.words.Table are in unnamed module of loader ‘app’)
PFB the complete function:
private List<Document> splitDocumentWithAspose(Document document, int noOfSplits, int totalPageCount) throws Exception {
log.info("splitDocumentWithAspose - split document into {} sub-document", noOfSplits);
List<Document> documents = new ArrayList<>();
for (int split = 0; split < noOfSplits; split++) {
int startIndex = split * 10;
int endIndex = startIndex + 10;
int count = totalPageCount > endIndex ? 10 : (totalPageCount - startIndex);
Document splitDoc = document.extractPages(startIndex, count);
log.debug("splitDocumentWithAspose - adding splitted document at position {} into documentList", split);
documents.add(splitDoc);
}
log.info("splitDocumentWithAspose - total number of split documents are: {} ", lazy(documents::size));
return documents;
}
Attaching document:
Feya Textiles_01_08_2024_Final.docx (155.0 KB)
noOfSplits = 5, totalPageCount=41.