I'm trying to find some samples (or better just help) in getting a grid to properly render through the document exporter.
I have a grid with a couple of bands that I'm trying to export. My issue is that I don't seem to be able to get the contents of the cells to appear without being clipped (row height) or to be able to set a column width no matter what I do.
I've tried setting row height and cell width properties in the grid InitializeLayout and InitializeRow evants which does not seem to have any impact. I then tried messing with things in the Exporter CellExported event, again it does not seem to make any difference in the resulting output.
I started playing with this because the exporter does not seem to handle the <br/> tag in formatted cell. So I attempted to calculate the cell height/width of the text based on using the grid font and a TextRenderer.MeasureText. This calculates a height and width but when applied to the row/cell it does not seem to change anything. I've also (just for testing) tried to set the cell width to some fixed size, when the cell is rendered it appears to be set back to the default size of 100. So, again, I'm confused by printing/exporting support in the exporter.
Any pointers to reasonable samples or documentation would be helpful at this point.
Neil
Hi Neil,
I'm pretty sure this is a known bug (regarding the </br> tags). It should be fixed in the next hot fix.
My guess is that the settings you are applying to the grid are not honored because the UltraGridDocumentExporter auto-sizes the rows and columns in the grid by default. There's a property on the component (AutoSize, I think) so you can turn this off. But if you turn it off, it means you have to size all of the grid columns and/or rows yourself.
Thanks for the response. I've tried turning everything I was doing off and just letting the grid autosize "work". What I get is the attached image (the circles I added). In this case, even though there is lots of room on the page, the first column (Wines) is wrapped and clipped (the last line in the cell is not displayed) and the "Note" column is also wrapped. It appears to me as though the columns are only being sized based on the column header.
Is there anything that I can do in the layout or initialze row or one of the "exported" events to modify the output?
Thanks
I'm not sure I understand your question. What's this about letting the grid autosize work? As I said, this is a known bug. The grid's automatic autosizing will NOT work. At least not until the Hot Fix is released.
Your original question was about how to set the size of the column and row yourself and have that picked up by the export. The way to do that is to turn off the AutoSizing on the UltraGridDocumentExporter. Figuring out the appropriate Width and Height of the cell to use is, of course, impossible because of the bug. But if you want to just make the cell very very large so it accounts for the text, then you could do that.
I see, sorry, I thought that the defect we were talking about had to do with not handling the <br/> properly in a cell. What I did there was to replace the text on print with <p/> and that seemed to work (not the look I want but it gave me new lines. I did not realize that the problem was with autosize not working at all.