Softartisans' ExcelWriter v8 bug - officewriter

The Softartisans' ExcelWriter v8 seems having a bug on merged cell formula. For example:
ExcelApplication xla = new ExcelApplication();
Workbook wb = xla.Create(ExcelApplication.FileFormat.Xlsx);
area = ws.CreateArea(1, 0, 1, 2);
area.MergeCells();
cell = ws.Cells[area.FirstRow, area.FirstColumn];
cell.Formula = "=A1”;
The formula will be disappeared on the worksheet.
BTW, it works on xls format.
Is there an acceptable workaround?

I work for SoftArtisans.
We have reproduced this behavior, and it does appear to be a bug. We will submit it to Development and will update this thread when we have news.
In the meantime, here is a suggested workaround:
area = ws.CreateArea(1, 0, 1, 2);
area.MergeCells();
cell = ws.Cells[area.FirstRow, area.FirstColumn];
cell.Value = ws.Cells["A1"].Value;
What we have done here is to assign a value to the cell instead of the formula. If the formula is a cell reference as in your example, this is a simple task. However, for more complex formulas, you will have to do the calculations in your code.
The drawbacks of this approach are that there is no longer a live formula within the cell, so it will not be updated automatically by any changes in the output file by the user.
Thank you for bringing this issue to our attention.

This issue has been fixed in the recent 8.5.1 release of OfficeWriter. Formulas are now preserved properly in merged cells in .xlsx files (this always worked properly with .xls files). See the OfficeWriter change log.

Related

#officewriter - Worksheet.PopulatedCells.AutoFitHeight(); not working

#officewriter - Worksheet.PopulatedCells.AutoFitHeight(); not working.
Recently i have updated excel version from xls to xlsx, but now the above function is not working, giving below error.
Error : No cells have been populated in the Worksheet
Populated cells will look for cells with values in them and return an
area that includes all the cells. If populated cells have no values
then it will thrown an exception, however if that is the case there is
nothing to autoFit.
One way to work around this would be to define the area to autofit
(say the whole worksheet) and then call autofit. Then you don't have
to rely on populated cells to determine the area.

LibreOffice BASIC function - Copy if over a value to a new sheet

I'm trying to create a simple function on a LibreOffice Calc sheet.
I have a table of information where cells A1:K2 has headings (the cells in Row 2 are merged)
all the information runs from A3:K176
The sheet has various functions running on it already, all I need is one more function.
At first I wanted it to automate when i open, but then i thought running the BASIC macro off of a button might be better, so i can edit and then just hit the button once I'm done.
I have the button linked up to run the macro already, but now im stuck... I have tried many ways of writing the code, but it seems that i am just too green to figure it out.
the last time i ran Excel advanced functions i was in high school.
ok, enough talking...
All I need the macro to do is once I hit the button, I need it to check column K and any value > 1 it needs to take that whole row and copy it then go to a target sheet, clear any data on the target sheet. then copy that set of rows to the next open row in the target sheet. possibly even exporting the result to a .txt file as a bonus.
this is a start...
in future I would like to add another button that will do the same function to a array lower down and put that into a different sheet.
Option Compatible
Sub SWD_AwakeningsTrade
Dim i, LastRow
LastRow = Sheets("Card_List").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Awakenings For trade").range("A2:I500").clearContents
For i=2 to LastRow
If Sheets("Card_List").Cells(i,"K").Value = "(>1)" Then
Sheets("Card_List").Cells(i, "K").EntireRow.Copy
Destination:=Sheets("Awakenings For trade").Range("A" & Rows.Count.end(xlUp)
End if
next i
End Sub

DevExpress set focus to specific row of VerticalGrid

My code to set the focus to a specific row of the VerticalGrid is not working.
this.ActiveControl = vGridControl1;
vGridControl1.Focus();
vGridControl1.FocusedRow = vGridControl1.GetRowByFieldName("addr1");
I have confirmed that vGridControl1.GetRowByFieldName("addr1") returns the correct row.
The first row contains a ButtonEdit, and that is where focus always goes.
The grid is in MultiRecordView but at this point contains only one (new) blank record. Adding
vGridControl1.FocusedRecord = 0;
before setting the FocusedRow doesn't make a difference.
What step am I overlooking?
Try using this which worked for me...
vGrdSummary.Focus()
vGrdSummary.FocusedRow = vGrdSummary.Rows("rowNatureOfLoss")

birt report tables not displaying in PDF

I've created a BIRT report in Eclipse (Juno) using BIRT v 4.2. The report has four tables, all tables are contained within grids. When I preview the report all the data displays properly, but if I select run as .pdf only a 2-3 rows of each table are displaying. I can export the report as html, xls and view it in web viewer without an issue. Has anyone else experienced this? (I've validated the sizing of the grid and tables).
I had the same issue and to overcome the problem I simply increased the size of the grid to fit the page manually.
If your rows are going to another page you need to script your way around that issue and you can find the solution here:
data cut when exporting as PDF
Update to cover broken link:
Quoting Michael Willians:
The PDF won't adjust like the GUI because of the fixed size constraint. To get a long, unbroken string to break, you'll have to add break characters of your own, either in a computed column or using a dynamic text box to write the script to break the long text up. Once you've broken the long text up, it should wrap to multiple lines within your PDF.
As an example, you could do something like this in a computed column, replacing "data1" with your column's name:
temp = "";
i=0;
while (i<row["data1"].length){
if (row["data1"].length - 10 < i){
temp = temp + row["data1"].substring(i,row["data1"].length);
}
else{
temp = temp + row["data1"].substring(i,i+10) + "\n";
}
i += 10;
}
temp;
To apply changes in the entire report, you could do a script in your beforeFactory method, stepping through your data elements, changing their expression. The easiest way would be to name your data elements, element1, element2, element2, etc., in the property editor. Then, you can easily access them by name, in your script.
Here's were you can edit the beforeFactory method, or any other:
You may also maintain a separate script with all your changes, as you can see on the resources directory:
Remember to add it as a Javascript resource:

Jasper report excel cutting off cell

I want to export to excel, but I want the data to print in a cell irregardless of how much data it is. I have tried setting the "Stretch with Overflow" option and that appears to work, but it creates empty rows between actual data rows. I tried adding the IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS to true and it does not resolve my issue. I am also using IS_IGNORE_PAGINATION.
Ideally I want excel exports to just put all the data in a cell independent of the size of the cell.
I found the answer. You need to set the net.sf.jasperreports.print.keep.full.text report parameter to true
#DMoses: I had the problem of the empty rows a lot using the "Stretch with Overflow" and it was generated because I left unconsciously a space between the cell where I display the data and the margin of the report. Just put the cell at the edge of the margin and then you won't have that problem.