iReport (JasperReports) extra row issue - excel

I am getting an extra empty row between data when I am importing it from the database and formatting the report in Excel sheet.
EDIT (clarification from a comment): The output in Excel shows an extra blank row between records and and extra blank column between fields.

Add net.sf.jasperreports.export.xls.remove.empty.space.between.columns and net.sf.jasperreports.export.xls.remove.empty.space.between.rows properties to report template.
net.sf.jasperreports.export.xls.remove.empty.space.between.columns - Specifies whether the empty spacer columns should be removed or not.
net.sf.jasperreports.export.xls.remove.empty.space.between.rows - Specifies whether the empty spacer rows should be removed or not.
The sample:
<jasperReport ...>
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
The information about configuration properties is here.
You can set isRemoveLineWhenBlank and isBlankWhenNull for textField element for hiding blank row.
The sample how to remove the whole line if the current textField is empty:
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="100" height="20" isRemoveLineWhenBlank="true"/>
<textElement/>
<textFieldExpression><![CDATA[$F{field}]]></textFieldExpression>
</textField>
Another assumption is to change the height of all textField (or/and staticText) elements in the Band.
In case this design:
you will have a space between any two rows.
In case this design (textField height is equal to the Band's height):
the each line will be exactly under the other.

Every thing that Alex K states in his Dec 2 '11 answer is correct. But a few other settings may be helpful. These settings help when the text of the report stretches the detail band.
On every field in the detail band set:
positionType="Float"
stretchType="RelativeToTallestObject"
Example:
<detail>
<band height="20" splitType="Prevent">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" mode="Transparent" x="372" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{your column name}]]></textFieldExpression>
</textField>
This will force the all fields to be one height. The float setting tells the field to minimize the distance between the previous and next row. The RelativeToTallestObject setting tells all fields in the band to be the same height as the tallest field. These two settings help eliminate 'empty space' which shows up as unwanted cells in Excel.

Related

ProgressBar single color gradient

I have this code for a shape (it's set as progressDrawable in ProgressBar):
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:shape="ring"
android:thicknessRatio="16"
android:useLevel="false">
<solid android:color="#DDD" />
</shape>
</item>
<item>
<rotate
android:fromDegrees="270"
android:toDegrees="270">
<shape
android:shape="ring"
android:thicknessRatio="16"
android:useLevel="true">
<gradient
android:endColor="#color/red"
android:startColor="#color/blue"
android:type="sweep" />
</shape>
</rotate>
</item>
As it is specified, color changes throughout the circle as gradient from blue to red. For example, at maximum gradient value (100) the start is blue and at the end is red. How can I set so the color is only one? As for example, 100 value would set all circle to be red, 70 (some sort of orange), 50 (some sort of yellow) - the whole circle till the specific value must be single color, not of mixed colors. Thank you.

Better text in SVG announcements in screen readers (VoiceOver)

I have an SVG figure that represents a name card for a person:
<svg
viewBox="0 0 300 100"
style="border: 1px solid black;"
>
<g>
<text x="5" y="25">Name</text>
<text x="120" y="25">Joe Smith</text>
</g>
<g>
<text x="5" y="55">Age</text>
<text x="120" y="55">55</text>
</g>
<g>
<text x="5" y="85">Occupation</text>
<text x="120" y="85">Astronaut</text>
</g>
</svg>
VoiceOver reads it like this:
Name, group
Name
End of, name, group
Joe Smith, group
Joe Smith
End of, Joe Smith, group
Age, group
Age
End of, Age, group
55, group
55
End of, 55, group
Occupation, group
Occupation
End of, Occupation, group
Astronaut, group
Astronaut
End of, Astronaut, group
It's very, very verbose. How do I modify this code to make VoiceOver read it like this?
Name
Joe Smith
Age
55
Occupation
Astronaut
I'm looking for a solution using SVG / ARIA. I know I can implement this using HTML and achieve better results in VoiceOver, but this is just a dummy example to illustrate the problem.
You can safely remove the <g> elements as they serve no real purpose for display (they are used for layering in an editor and as a possible point to apply transforms, styling etc.)
After doing that the element will read correctly.
I recommend using SVG OMG to optimise your SVGs, especially if they are large and complex graphics. You may still need to remove some <g> tags, you can safely do this just using a replace function on <g> and </g> (the hacky way!) or better yet use an XML reader / writer and do it properly!

Calculation of PI() and 3.14159265358979 in excel

In Excel while Calculating =SIN(PI()) formula it returns 1.22515E-16.If the PI() Value(3.14159265358979) is directly given like =SIN(3.14159265358979), it returns 3.23114E-15.
Please anyone can share your opinion about how the excel calculates differently, when 'PI' and 3.14159265358979 are passed as parameter.
Let's have the following example:
A2 is formula =PI().
A3 is value 3.14159265358979.
A5 is value copied from A2 and then paste-special: Values only.
Formula in column B is =SIN(A2) ... =SIN(A5).
So what is happening here?
While Microsoft justifies the truncating values to 15 digits with using double floating point precision according IEEE 754, this is not the whole truth. According IEEE 754 the possible count of decimal digits is not exactly 15 but 15.95 in average. So there are more digits possible in some cases. And if so, Excel stores up to 17 digits in its files although it shows only 15 digits in its sheet views and also only 15 digits can be input in its sheet views.
So =PI() will result in 3.1415926535897931 exactly and this value will also be stored. But manual input can only be 3.14159265358979. But if you copy/paste-special:Values the result of =PI(), then also 3.1415926535897931 will be stored although only 3.14159265358979 is shown.
Since *.xlsx files are simply ZIP archives, we can unzip them and look at /xl/worksheets/sheet1.xml. There we will find:
<row r="2" spans="1:2" x14ac:dyDescent="0.25">
<c r="A2" s="1">
<f>PI()</f>
<v>3.1415926535897931</v>
</c>
<c r="B2">
<f>SIN(A2)</f>
<v>1.22514845490862E-16</v>
</c>
</row>
<row r="3" spans="1:2" x14ac:dyDescent="0.25">
<c r="A3" s="1">
<v>3.14159265358979</v>
</c>
<c r="B3">
<f>SIN(A3)</f>
<v>3.2311393144413003E-15</v>
</c>
</row>
<row r="5" spans="1:2" x14ac:dyDescent="0.25">
<c r="A5" s="1">
<v>3.1415926535897931</v>
</c>
<c r="B5">
<f>SIN(A5)</f>
<v>1.22514845490862E-16</v>
</c>
</row>
q.e.d.
The reason you are seeing this is because of a rounding error.
Sin(PI()) is technically 0, as detailed in the Sin function documentation. However, excel returns 1.22515E-16 or 0.0000000000000001225148455
(i.e. approximately 0)
3.14159265358979 is a approximation of PI(), so it returns a different number that it also approximately 0. If you try 3.1415926535897, 3.141592653589 etc, you will get a different number each time.
This is likely related to working with floats, but I don't know enough about Excel and how it stores data to elaborate.
The SIN() function accepts the parameter in radians.
To convert an angle to radians, the value must be multiplied by PI()/180.
If you use =SIN(PI()), the PI is considered as a radian which is equal to RADIANS(180). Both =SIN(PI()) and =SIN(RADIANS(180)) returns the same result 0.
=SIN(3.14159265358979) is not actually equal to =SIN(PI()) because the PI in this context is different. And hence the different result.
The bottom line is to always use radians as a parameter for trigonometric functions.

What is the first and last number in the points attribute for an svg polygon?

I'm trying to understand what the first and last number value in points attribute represent, but MDN doesn't seem to explain this, it actually says there needs to be two numbers, however I keep seeing this first and last pattern. I keep noticing that there are pairs of numbers, the values that represent the x and y axis of the point, however their is just a single number that isn't a pair at the beginning and end?
<svg height="210" width="500">
<polygon points="100,10 40,198 190,78 10,78 160,198">//what does first and last number mean?
<style="fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;" />
</svg>
You are misinterpreting the numbers and their separators.
In a points value like the following:
100,10 40,198 190,78 10,78 160,198
The X and Y coordinates are separated by a comma, and the pairs are separated by a space (but using a comma is also allowed here).
So there are five X,Y coordinate pairs: (100,10) (40,198) (190,78) (10,78) and (160,198)

How can I prevent the "Number Stored as Text" err indicators from displaying in an Excel sheet exported from an SSRS report?

I get the green triangle error messages on all the numeric values on my report:
These are visible if the Excel user has checked "Enable Background Error Checking" in the Formulas tab on the Excel Options dialog; the err msg that displays is:
It's true that the ItemCode and PriceWeek (shown with a data range as a column heading, in this case 5/1 to 5/7) fields are Strings, but the Variance field, which is also green flagged as problematic, is a Decimal:
<Field Name="ItemCode">
<DataField>ItemCode</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="PriceWeek">
<DataField>PriceWeek</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Variance">
<DataField>Variance</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
So what can I do to solve the problem if even Decimal values are seen as Strings masquerading as Numbers. The data is what it is (Strings, for the most part) so is there a way to cast them all as the type of Number SSRS-to-Excel needs to prevent the green triangle error indicators?
And yes, the fact that two of my column headers (they should read "05/01/2016 to 05/07/2016" to the right of "Member" and "05/08/2016 to 05/14/2016" to the right of "Variance") are dropping through the bottom of the header row (in the exported Excel sheet only - not on the Preview tab or when exported as a PDF) is already a post here.
UPDATE
Here are the only two places in the rdl/xml file where "$" is encountered (where the string values are being cosmetically changed to "currencty" values:
. . .
<Value>=IIF( (Fields!regionorder.Value=1000), "", IIF((Fields!Price.Value=""),"$0.00","$"+Fields!Price.Value))</Value>
</Textbox>
<Textbox Name="Variance">
. . .
<Format>$#######0.00</Format>
. . .

Resources