template1.zip (60.2 KB)
I’m trying to use the smart markers in java application to generate the pdf report but
Lengthy string is rendering in multiple pages in pdf while using smart markers in Java.
like in one page one line of text and in 2nd page another line of text. please refer the output pdf.
Please find the attached template file having smart markers and output pdf file as welSample2.pdf (61.3 KB)
l.
NOTE1: I tried with the below specified code for work around , but did not work.
Worksheet worksheet = workbook.getWorksheets().get(0);
worksheet.autoFitRows();
worksheet.autoFitColumns();
NOTE2: I tried with below specified code , but it’s rendering the entire text in one, which i do not require.
// PdfSaveOptions ps = new PdfSaveOptions();
// ps.setAllColumnsInOnePagePerSheet(true);
------------------------------------ w.getWorkbook().save(“H:\mytickets_fenis\AsposePoc\src\main\resources\Sample2.pdf”, ps);
But I need to generate the pdf report having paragraphs with no of lines for example:
The sample lengthy string is Below specified :
“Since your serial number column does not come from your source and exists outside of Smart Markers, so you cannot evaluate auto-numbers in the data source or in smart markers. You have to insert/merge those serial numbers manually after your markers are processed and data is filled into the cells. For example, you may count the number of records/rows in your custom list, so you may insert counter (serial numbers) into the cells of the first column via Cell.putValue() method. You may simply use some loop to be iterated upto number of records in the list to specify the (variable) counter (e.g. cnt++) to be inserted into the cells of the column accordingly.”;
like the above paragraphs.
Could you please suggest/provide the idea to achieve my requirement.
below is the snippet in java:
I’m using aspose-cells 21.9 version.
String s = “Since your serial number column does not come from your source and exists outside of Smart Markers, so you cannot evaluate auto-numbers in the data source or in smart markers. You have to insert/merge those serial numbers manually after your markers are processed and data is filled into the cells. For example, you may count the number of records/rows in your custom list, so you may insert counter (serial numbers) into the cells of the first column via Cell.putValue() method. You may simply use some loop to be iterated upto number of records in the list to specify the (variable) counter (e.g. cnt++) to be inserted into the cells of the column accordingly.”;
WorkbookDesigner w = new WorkbookDesigner();
byte[] photo1 = Files.readAllBytes(Paths.get(“H:\mytickets_fenis\AsposePoc\src\main\resources\SmartMarkers\TMS.PNG”));
Workbook workbook = new Workbook(“H:\mytickets\AsposePoc\src\main\resources\template1.xlsx”);
w.setWorkbook(workbook);
List ds = new ArrayList<>();
ds.add(new DataSource(“abc”, "def xyz address line 1 ",
“Cust 8978123 address line 2”, s,
“apuy897”, “United nations”, “1testsubject 2testsubject 3testsubject 4testsubject 5testsubject”));
w.setDataSource(“DS”, ds);
w.process(); w.getWorkbook().save(“H:\mytickets\AsposePoc\src\main\resources\Sample2.pdf”);
This Topic is created by amjad.sahi using Email to Topic tool.