I'm facing a problem with birt report , in the first column i have an image to display , when exporting to excel i see that there is a lot of merged cell together : see the picture below
NB:when exporting to excel i'm using an emitter
options = new EXCELRenderOption();
options.setOutputFormat("xls");
options.setOption(IRenderOption.EMITTER_ID, "org.eclipse.birt.report.engine.emitter.nativexls");
any help how to fix this please?
Related
I am using Dynamic Reports to create Reports and am able to create it. But the issue is that when i convert it to excel, the cell in the excel showing a warning as Number Stored as Text. Because of this no operation is possible.
Here is my code
File file = new File("c:/report.xls");
JasperXlsExporterBuilder xlsExporter = export.xlsExporter(file).setDetectCellType(true).setIgnorePageMargins(true)
.setWhitePageBackground(false).setRemoveEmptySpaceBetweenColumns(true);
report.addProperty(JasperProperty.EXPORT_XLS_FREEZE_ROW, "2").ignorePageWidth().ignorePagination().toXls(xlsExporter);
How to remove this error.
Add the following line to your code:
<property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
Source
EDIT
In the Dynamic Reports samples, the report variable also sets the following. This could help depending on the column.
.columns(
itemColumn,
col.column("Quantity", "quantity", type.integerType()),
col.column("Unit price", "unitprice", type.bigDecimalType()))
I am using aspose-cells-8.7.2-java. When I refresh the pivot table and save it, the excel file is getting corrupted. When I try to open the excel file I am getting the alert message as below :
"Excel found unreadable content in 'Book1.xlsx'.Do you want to recover the contents of this workbook?If you trust the source file of this workbook, click yes."
The code is as below :
Workbook wb = new Workbook("Book1.xlsx");
PivotTable pt = wb.getWorksheets().get(1).getPivotTables().get(0);
pt.refreshData();
pt.calculateData();
wb.save("Book1.xlsx");
Any help ?
I found this thread where the same issue is logged as a ticket :
http://www.aspose.com/community/forums/thread/683715/aspose.cells-generates-a-corrupted-xlsx-file-excel-2007-fails-to-open.aspx.
Is this issue solved?
I'm afraid the logged issue is not resolved yet. By the way, do you use similar Excel file or yours template file "Book1.xlsx" is different. Moreover, your issue can be template specific (if you are using different file) and might have different scenarios, so we need your template "Book1.xlsx" file to properly evaluate your issue on our end. We recommend you to kindly create a separate thread in Aspose.Cells forum with your template Excel file, we will evaluate your issue and help you better there.
I am working as Support developer/ Evangelist at Aspose.
Dear all,
I'm working with Apache POI and I would like to duplicate a slide containing several charts from code.
The code below (inspired by https://poi.apache.org/slideshow/xslf-cookbook.html#Merge) works fine when there is no chart on the slide.
Unfortunately, it seems that the charts are not duplicated with this method: when I try to open the resulting file, Powerpoint detects a problem, tries to repair it, but fails, and I get empty slides.
I've checked the underlying XML files (using Open XML SDK), and it seems that the chart themselves (in the folder /ppt/charts) are not duplicated, and the relationship files (in the folder /ppt/slides/_rels) are not completely updated.
Here is my current code:
// Open slideshow
FileInputStream fileInputStream = new FileInputStream(sourceFilePath);
XMLSlideShow slideShow = new XMLSlideShow(fileInputStream);
fileInputStream.close();
// Duplicate slide
XSLFSlideLayout layout = slide.getSlideLayout();
XSLFSlide newSlide = slideshow.createSlide(layout);
newSlide.importContent(slide);
// Save updated slideshow
FileOutputStream fileOutputStream = new FileOutputStream(outputFilePath);
slideShow.write(fileOutputStream);
fileOutputStream.close();
Do you know how I could clone a slide and its charts ?
Thanks a lot, and best regards!
You can't. I tried and tried, the problem is that the duplication does not handle images or charts.
I had to copy files by hand through a script. Here are the steps:
Locate the slide file
Duplicate it
Find the chart object in the XML file, and note the relation Id
In the relations file, check which file is designated by the relation Id
Duplicate this file
You also have to duplicate the relation file for the new slide, and update the name
The new slide is not visible, you have to update presentaion.xml
Please note: if you want your PPTX to work with Microsoft Powerpoint, you'll also have to duplicate associated Excel workbook (see in the relation file of the chart)
My problem was really close to yours with version 5.2.2, the chart was indeed correctly duplicated but the reference to the internal workbook of the sheet was copied too, by reference ! (It's actually done here : https://apache.googlesource.com/poi/+/refs/tags/REL_5_2_2/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java#241 )
It means that when I edited the chart values in the duplicated slide I edited both chart values. It makes visually no difference in powerpoint at first but when you right-click>edit data on the chart, it re-renders and the data changes visually.
To avoid that, just re-set the workbook of the chart to null so that it creates (or really load from the relation part) a new one for the duplicated chart
The code to duplicate a slide with a chart should look like this :
XSLFSlide oldSlide = ppt.getSlides().get(number);
XSLFSlideLayout layout = oldSlide.getSlideLayout();
XSLFSlide newSlide = ppt.createSlide(layout);
newSlide.importContent(oldSlide);
newSlide.getRelations().stream()
.filter(r -> r instanceof XSLFChart)
.forEach(chart->((XSLFChart)chart).setWorkbook(null));
//to force loading the correct worksheet
I hope it help some people stumbling upon this :)
Since Apache POI 4.0.0, the original code from the question will work to duplicate a slide.
I am using package xlsx Version:0.5.7 Date: 2014-08-01. in R version 3.0.1 (2013-05-16) -- "Good Sport" Platform: i386-w64-mingw32/i386 (32-bit).
I have an xlsx file with at least 2 sheets (say A and B). I need to read data from A, edit them and save them in B. This has to be done on a periodical base.
I am able to read data from A with read.xlsx. After editing the data frame I want to save it in an existing sheet B in the same xlsx file.
I try with this line
write.xlsx(down, paste0(root,'/registration reports/registration complete_WK.xlsx'), sheet="data_final", col.names=T, row.names=F, append=T, showNA=F)
but it give me this error:
Error in `.jcall(wb, "Lorg/apache/poi/ss/usermodel/Sheet;", "createSheet", ` :
java.lang.IllegalArgumentException: The workbook already contains a sheet of this name
I need to replace that existing sheet multiple times. How can I do that?
If you want to save your new dataframe in an existing excel file, you first have to load the xlsx-file:
wb <- loadWorkbook(file)
which sheets you have you'll get like this:
sheets <- getSheets(wb)
you can easily remove and add (and thus replace) sheets with:
removeSheet(wb, sheetName="Sheet1")
yourSheet <- createSheet(wb, sheetName="Sheet1")
than you can fill the sheets with dataframes:
addDataFrame(yourDataFrame, yourSheet, <options>)
addDataFrame(anotherDataFrame, yourSheet, startRow=nrow(yourDataFrame)+2)
and last step is saving the whole workbook as .xlsx:
saveWorkbook(wb, file)
btw: the documentation of the xlsx-package is really good and helpful on such questions :)
http://cran.r-project.org/web/packages/xlsx/xlsx.pdf
It may be that the Java installed on your computer is incompatible with the xlsx library. The following thread discusses a similar issue with regard to the same package:
enter link description here
Alternatively, your issue may be solved by a different Excel-related package, such as XLConnect. See this post:
enter link description here
Does anyone have idea regarding the RTF2FO 3.5.0.
I am trying this to convert rtf to fo file,it worked... but i am facing a issue in table formation and pictures.
Can I set a path were i can save picture from RTF files with out the
default folder (.images), which the RTF2FO create in default.
Can I set the table layout and the width properties in percentage
"%", default is "pt".
can any one help me out.