Free Support Forum - aspose.com

Problem with excel conversion to pdf all data in excel not displaying in pdf

hi


i am facing problem with multi header data in excel while converting to pdf. Only the first row is appearing in PDF. i am attaching excel and pdf.

i highlighted the problamatic portion in the excel file.


thanks

Hi,

Thanks for your posting and using Aspose.Cells for Java.

Thanks
for highlighting the issue. We have now logged your issue in our
database. We will look into your issue and fix it. Once the issue is
fixed or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSJAVA-40432.

Hi,

Thanks for your posting and using Aspose.Cells for Java.

We have fixed this issue.

Please download and try this fix: Aspose.Cells for Java v7.4.0.3 and let us know your feedback.

Please set this flag “save source data with file” to true in pivot table’s
options . The picture is in appendix.

hi thanks for the fix.

i got that problem fixed but in another template i am not getting what i am expected

i highlighted the portion which is causing the issue.

i modified the flag “save source data with file” to true in pivot table’s
options .

please look into this and provide me the suggestion to solve this issue.


thanks

Hi,


I tried the new fix v7.4.0.3 and it works fine. Here is my output PDF that I got by simply opening your attached file and save it to PDF by Aspose.Cells for JAVA v7.4.0.3.

If you still find the issue, give us your sample code on how did you create your output PDF file. We will check it soon.

Thank you.

hi

i am attaching sample code

Workbook workbook = new Workbook(excelFileName);
workbook.calculateFormula(true);
int sheetCount = workbook.getWorksheets().getCount();

for (int i = 1; i < sheetCount; i++) {
Worksheet ws = workbook.getWorksheets().get(i);
ws.autoFitRows();

ws.getPageSetup().setFitToPagesWide(10);
ws.getPageSetup().setFitToPagesTall(1);
ws.getPageSetup().setPaperSize(40);
ws.getPageSetup().setOrientation(1);
ws.getPageSetup().setZoom(20);
ws.setGridlinesVisible(true);

System.out.println(ws.getCells().getMaxDataColumn());
ArrayList colsFromExcel1 = new ArrayList();
if(excelFileName.contains(“Extract”)){



Row row1 = ws.getCells()
.getRow(0);
Iterator im1 = row1.iterator();
while (im1.hasNext()) {
Cell cell = (Cell) im1.next();
colsFromExcel1.add(cell.getStringValue());
}
System.out.println(“cols size after formatting:”
+ colsFromExcel1.size());
}

for(int k =0;k<ws.getPivotTables().getCount();k++){
System.out.println(“in start…1111… 2222222222222222222222222”);
//ws.getPivotTables().get(k).setRefreshDataOnOpeningFile(true);
ws.getPivotTables().get(k).setRefreshDataFlag(true);
if(excelFileName.contains(“Extract”)){


}else{
ws.getPivotTables().get(k).refreshData();
}

ws.getPivotTables().get(k).calculateData();
ws.getPivotTables().get(k).setRefreshDataFlag(false);
}



if(excelFileName.contains(“Extract”)){
for (int v = 0; v < colsFromExcel1.size(); v++) {
ws.autoFitColumn(v);
ws.autoFitRows();

//if(v==0) continue;
if(ws.getCells().getRows().getRowByIndex(1).get(v).getDisplayStringValue()!=""){
System.out.println(ws.getCells()
.getRows().getRowByIndex(1).getCellByIndex(v)
.getType());


// Style style = null;
StyleFlag flagin = null;
flagin = new StyleFlag();
Style style = workbook.getWorksheets().get(i)
.getCells().getRows().getRowByIndex(1)
.getStyle();
style.setCustom("@");
flagin.setNumberFormat(true);
// sheet.Cells.ApplyColumnStyle(dateCol.Column,
// style, flag);
ws.getCells()
.getColumns().getColumnByIndex(v)
.applyStyle(style, flagin);




}

}

}

}
//save the workbook as pdf report. Save pdf with same name
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();

workbook.save(getPdfFileName(excelFileName), pdfSaveOptions);
} catch (Exception ex) {
ex.printStackTrace();
//log.error("Failed to generate PDF report " + excelFileName, ex);
return false;
}

Hi,


Thanks for your sample code.

I have tested your issue a bit. When I add the line to your code at the end, e.g
}
workbook.save(“out_Copy+of+_Current_Plan_Report132.xlsx”);

//save the workbook as pdf report. Save pdf with same name
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
//…


I also get the similar Excel file as per your output PDF file. I have attached here for your reference. I am not sure if this is an issue with the product as when you perform the operation as per your code segments manually in MS Excel, it may give you the similar output. Could you try to do your steps manually and give us your output file here. We will log it and further investigate your issue on end.

Thank you.


hi

my excel file has pivoted options and it will generate data taking source as another sheet so when i convert that excel file as pdf i am not getting all the data in the pdf so i used the below code to refresh the pivoted sheets of each worksheet then i got all the data

for(int k =0;k<ws.getPivotTables().getCount();k++){
System.out.println(“in start…1111… 2222222222222222222222222”);
ws.getPivotTables().get(k).setRefreshDataOnOpeningFile(true);
ws.getPivotTables().get(k).setRefreshDataFlag(true);
if(excelFileName.contains(“Extract”)){


}else{
ws.getPivotTables().get(k).refreshData();
}

ws.getPivotTables().get(k).calculateData();
ws.getPivotTables().get(k).setRefreshDataFlag(false);
}


if i comment above code i am able to see my problem mentioned above is fixed but the data is not completely displayed in the pdf. (see pdf1)


but if try to use the above version of aspose cells i am not getting the problem which i mentioned above is not fixing (see pdf2)


i want both of the things to get worked. can you please provide me the solution for above problem.


thanks

Hi,


Thanks for providing us the further details and sample files (Excel file and PDF files).

I have logged your comments with your sample files into our database against your issue “CELLSJAVA-40432”. I have also reopened your issue now. Our concerned developer will look into it soon.

Once we have any update on it, we will let you know here.

Thank you.

Thanks Amjad.

waiting …fingers crossed… :slight_smile:

hi amjad

any update on the above issue?





Hi,

Thanks for your posting and using Aspose.Cells.

Please spare us some time. Our developers are on Spring Holidays, they will get back on next week.

Once, we will have some update for you, we will let you know asap.

Hi Shakeel

This is a high priority issue for us in our environment. So can you please provide the fix quickly so that we can apply it and test that.


thanks

Hi,

Thanks for your posting and using Aspose.Cells.

We have logged your comments against this issue. Hopefully, your issue will be fixed soon. Once, we will have some update for you, we will let you know asap.

Hi,

We are sorry that we could not support refreshing pivot table’s data without refreshing it’s source.

If you want both of the things to get worked, we recommend that you could set flag “refresh data when opening the file” to true in MS Excel first.

Then you could saving to pdf correctly without refreshing pivot table’s source.

You could see the picture and the result pdf in the appendix.


The issues you have found earlier (filed as CELLSJAVA-40432) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.