Dynamic row height for table - reporting-services

Using Reporting Services I need to make a table where I can set the row height dynamically depending on the length of the text in the cell, so when I export in Excel the height of the row will expand accordingly to a size that can be printed out without hiding any information It is in that row. I noticed that there is a problem with exporting in Excel, and that the propriety 'CanGrow' is not really working to expand the row height as it should.
So, there is a way I can set a height for every table row, or a method to make Excel export with a correct height every row depending on the length of the text in the cell?

Try this code. I have used this code to set the height of row according to length of text:
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
float a = 54.0f * [[yourArray objectAtIndex:indexPath.row - 1] length]/25.0f;
return a;
}

Related

getRowHeight() returns default row height instead of actual height, when text wrap is enabled

I want to be able to format and adjust the size of the rows programmatically when creating a report in Google Sheets so that I don't have the header stuck on one page and then content on the next with a multi page report. It looks bad.
So if I could determine the height of each row, then I could determine whether the header will be stuck on one page and the content on another.
It appears that the getRowHeight() function only returns the height of the row if a height has been specified for the row.
The function will return the default height of the row, even if the row height has been adjusted/increased because of using wrap text. With wrap text the row height has been increased because of the text wrapping to the next line in the cell.
Is there another solution for determining row height in order to programmatically determine what rows will print on which page?
function test2(){
var defSpreadsheet = SpreadsheetApp.getActive()
var sheet6 = defSpreadsheet.getSheetByName("Sheet6")
sheet6.activate();
sheet6.showSheet();
var startingrow = 1;
for(var i= 2;i<4;i++){
sheet6.getRange(i,5).setValue(sheet6.getRowHeight(i));
}
}
Easier way is to freeze the rows you want in each page, and then print.
(
Row & column headers
Go to View > Freeze to select which rows/columns to repeat on all pages)
When you print from goole sheet, you will get the option at the last in
"Header and footer section"
--> "Row and column headers" will be highlited, and you can edit if needed
Thank you

Google Sheets setRowHeight() auto-fitting, NOT resizing to set value

I've a Google form/sheet which collects data creating cells that are so large that navigating up and down rows becomes tricky.
The below function should resize all rows (except the header row 1) to 50.
However, when it runs, all rows Auto-fit the data, again making it again unwieldy.
var sheetResponses = 'Form responses 3';
var ss = SpreadsheetApp.getActiveSpreadsheet();
var responsesSheet = ss.getSheetByName(sheetResponses);
var responseData = responsesSheet.getDataRange().getValues();
// Sets all rows to a height of 50
function resizeRowsTo50() {
responsesSheet.setRowHeights(2,responseData.length,50);
};
Can anyone spot what I've done wrong? Even if I manually resize all of the rows to a uniform height beforehand, the function reverts them back to fit the data.
Thanks in advance.
Edit: Link to Sheet
It appears that setWrap and setWraps override any manual or
programmed (setRowHeight/setRowHeights) row height adjustment.
The documentation for setWrap and setWraps says "Cells with wrap enabled (the default) resize to display their full content" (emphasis is mine). That is, the cell width remains unchanged, and the row height changes to enable display of the entire content.
It goes on... "Cells with wrap disabled display as much as possible in the cell without resizing or running to multiple lines". In the later case, the amount of text displayed otherwise depends on the width of the column.
By comparison, when the settings are adjusted manually (the row height set to 50 pixels and text wrapping set to wrap), the row does not revert to auto-fit.
I've re-run my initial tests and I believe that I may misinterpreted your auto-fit comments when comparing my results. My apologies.
The auto-fit outcome appears deliberate on Google's part - even though the effect is very different to the effect of the manual "Wrap" adjustment. These are relatively new commands (at the time of writing) and there are very few examples to be found online.
I've raised this as a feature issue and we'll see whether that generates any clarification and/or change.
I found a poor decision for me in this tricky way:
- set Wrap to text wrapping;
- set setRowHeight;
- cut the string to such symbols amount which is enough for setted Row Height.
(but you still can see "fit to data" when you trying to resize your row)
I mean I fit my data to my rows hight before google sheet fit hight to my data:)

Bootstrap grid layout: force specific cells to always be in the same row

Using Bootstrap Grid Layout to show various forms. Cells are assigned width (e.g. 3 of 12 columns) and all of it is configurable. The problem is Label and Field width are supposed to be configured separately. E.g. labelA is width 2, fieldA is width 4, labelB is width 2, fieldB is width 4. This way user will see "2 column" layout: labelA-fieldA-labelB-fieldB.
However there's a problem if user decides to set label and field width to some other value, for example to span all row. User sets label B width to 4 and field B width to 8 expecting it to take whole row. However, in this case he'll get labelA-fieldA-labelB-[empty space for 2 columns] on the first row and fieldB on the second row. Obviously the intended solution would to have labelA-fieldA-[empty space for 6 columns], then labelB-fieldB on the next row. Again, this is all configurable so I need solution for all cases.
A perfect solution would be to have some way to force those cells (label and field) to be non-breakable. Can't find the way to do that.
Another way would be to create a container component with width=label.width+field.width. But then I'll have problems with setting label and field width inside of those containers because I can only set label/field width relative to direct parent and I need to set width relative to the parent's parent. I've heard there are ways to change number of columns in component on render and it'd work if I set number of columns to label.width+field.width. But as far as I understand it's a dirty solution.
The code is in React and this is what's generated for each label and field. InpComp may be any component, doesn't matter in the end. labelWidth and fieldWidth are set by configuration.
const labelWidth = this.getLabelWidthFromConfiguration();
const fieldWidth = this.getFieldWidthFromConfiguration();
return (
<div className={'component-container'}>
<div className={'col-md-${labelWidth}'}><b>{this.field.attributes.label}</b></div>
<div className={'col-md-${fieldWidth}'}>
<InpComp />
</div>
</div>);
What can I do to this code so that those label and field always end up on the same row?
what about an if-statement? ;)
you can do something like this:
if (lableWidth + fieldWidth !== 6) {
fieldWidth = 12 - lableWitdh;
}
This solution only works for one case (LA+FA = LB+FB = 6). You could set a condition for each case by your own using if/else or switch-case.
Like Troyer said, we're not here to show ideas or do your work, we are here to fix code problems. Next time you should try to solve your Problem by your own until you get in stuck and then provide your Code.

What is the equivalent of a div or table with fixed height in openxml/worprocessingml

I want to include a table inside a div element so that whatever the number of rows of my table, my document is always structured the same way.
How can I do that?
The second solution would be to define a fixed height directly to the table but i can't find how.
To set the height of the table you need to set the height of each table row, otherwise, it will autofit to contents.
Heres the C# sample code:
Table newTable = new Table(
new TableRow(
new TableRowProperties(
new TableRowHeight() { Val = (UInt32Value) x}),
new TableCell()));
x corresponts to the height in dxa points. One inch corresponds to about 1440 dxa points on my 1080p monitor at 72DPI.
Article on OpenXML sizing: http://startbigthinksmall.wordpress.com/2010/01/04/points-inches-and-emus-measuring-units-in-office-open-xml/
You can easily set the row height. Below I set the first row to at least 0.25" and the second to exactly 0.25"
<w:tr w:rsidR="00F11384" w:rsidTr="00F11384">
<w:trPr>
<w:trHeight w:hRule="exact" w:val="360"/>
</w:trPr>
...
<w:tr w:rsidR="00F11384" w:rsidTr="00F11384">
<w:trPr>
<w:trHeight w:val="360"/>
</w:trPr>

SSRS - Setting Table Row Height

I'm working in a SSRS report. I have a table in the report. How do I set the row height of the rows in the table?
Select the row you want to change the height of. With that row selected bring up the properties pane (Alt+enter if you don't see it). Scroll down to the position group of properties and specify the width and height there. The "cangrow" and "canshrink" properties are useful too sometimes.
Hope that helps!
Select one cell in a row , go to properties, go to size, give width and height and dis-select "allow textbox height to increase" and "allow textbox height to decrease" in textbox properties. Then it will effect on whole row.
You can edit the RDL(C) and set it exactly using an XML editor.
Look for the following:
...
<TablixRows>
<TablixRow>
<Height>1.5in</Height>
...
Note that you must have set the row height before there will be a Height node.
Since a tablix row doesn't have a dynamic height property (only CanGrow and CanShrink properties), I came up with a workaround.
You can use the length function LEN() in the Value expression for a cell in the row you want more height and add whitespace to the bottom (or top) of the cell with <br/> tags, thus effectively changing the row height dynamically.
To do this, first in the Placeholder Properties of the cell, change the markup type to "HTML - Interpret HTML tags as styles". (Just like changing the static row height property for a cell, this will change the height for the entire row.)
The "dynamic" whitespace you add to the bottom (or top) of the cell depends on how many <br/> tags you append to the value. Here's an example to add whitespace to the row if the cell has a value length of 100 or more characters (increasing the whitespace for every additional 100 characters in length).
=IIF(LEN(Fields!myText.Value) < 100, Fields!myText.Value,
IIF(LEN(Fields!myText.Value) < 200, Fields!myText.Value + "<br/><br/>",
IIF(LEN(Fields!myText.Value) < 300, Fields!myText.Value + "<br/><br/><br/><br/>",
Fields!myText.Value + "<br/><br/><br/><br/><br/><br/>"))))))
Make sure the CanGrow and CanShrink properties are set according to your needs. (For the example above, CanGrow is set to True.
From the Microsoft documentation Change Row Height or Column Width (Report Builder and SSRS):
In Design view, click a cell in the table row.
In the Properties pane that displays, modify the Height property, and then click anywhere outside the Properties pane.
Changing the height of one cell appears to affect the whole row. It worked for me.