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

Free Support Forum - aspose.com

Ability to copy paste a table from PDF to Excel correctly to cells (Java)

Use case:
We convert Html to PDF using your lib. And when we try to select and copy a table to Excel, the whole table is added to 1 cell.

Expectations:
Copied table rows and columns from generated PDF shall be pasted to Excel as separated cells. This means formatting shall be maintained.
Copy pasting a table from HTML to Excel works as expected, so maybe there is a property when converting Html to PDF, so it would work the same?

@giedrius14,

Thanks for contacting support.

Can you please share source files along with sample project to further investigate this issue. Also please share generated result and desired result as well.

	InputStream targetStream = new ByteArrayInputStream(renderedHtmlTemplate.getBytes(StandardCharsets.UTF_8));
	HtmlLoadOptions options = new HtmlLoadOptions();
	options.setInputEncoding(StandardCharsets.UTF_8.name());
	options.getPageInfo().setMargin(new MarginInfo(10, 10, 10, 10));
	options.setEmbedFonts(true);

	IDocument document = new Document(targetStream, options);
	document.setIgnoreCorruptedObjects(true);
	document.setFitWindow(true);
	document.setLayersAdded(true);
	document.setEmbedStandardFonts(true);
	document.setAbsentFontTryToSubstitute(true);
	document.save(outputStream);

tableExample.zip (2.8 KB)

Attached Html table file, and code snippet.

@giedrius14,

I have worked with source file and sample code shared by you and unable to observe the issue. I have also shared my generated result with you for your kind reference. Can you please share comparison screenshot pointing towards the issue.tableExample.pdf (93.7 KB)

Tried with your PDF and its still not as expected.
Im attaching a excel file,
1 sheet shows table copied from PDF,
2 sheet shows table from HTML (the expected way)

copyTableToExcel.zip (9.1 KB)

@giedrius14,

I have checked excel file shared by you. I have requested earlier can you please share comparison screenshot pointing towards the issue.

Added a screenshot with marked issue, it clearly visible in the column count.

copyTableToExcel.zip (135.5 KB)

@giedrius14,

I have observed your comments and like to inform that I have created investigation ticket with ID PDFJAVA-39400 in our issue tracking system to investigate and resolve this issue as soon possible.