Hi,
It seems that the UltraGrid has problems keeping the display and print out consistant with the layout done in the UltraGrid Designer:
Problems On the PDF export:1. The group by row on the original grid is missing2. The columns are not resized correctly to fit in the page horizontally - it just cramped to the left side of the page. (used SizeColumnsAndRowsToContent option)
Problems on screen display:1. The column layout has been changed unexpectly - column 9 and 10 got moved to the right of column 12. The header was resized even though Runtime Label Sizing was set to false.
So my questions are:1. How to make sure the PDF export contains the group by row?2. How to resize the grid in PDF export to extend and fit horizontally on the page?3. Why does the layout changed when displaying the grid (while exporting as PDF the column position is fine) ?4. How to prevent the grid column header from resizing (e.g. only resize the actual content cell) ?
By the way, the layout was done standard view (not card view) with label position on the left, and "Keep Headers with Cells" option checked. Does anyone else experiencing the same problem? Thanks for your help!
Hi Chris,
I'm having a hard time following what you are describing.
1) What GroupByRow are you referring to? I don't see any grouping in the screen shots you have here.
2) The way exporting to PDF works is that the columns are sized to their content and the report pages are sized to fit the width of the grid. There is currently no option to size the grid to fit the page, but you could probably acheive what you want by simply setting the widths of the columns manually and turning off the AutoSize on the DocumentExporter. You would have to determine the size of the page, of course, and the convert that from points to Pixels - the DocumentExporter assembly exposes methods that do this, I think.
3) I don't understand your question. You are saying that exporting the grid to PDF is changing the layout of the on-screen grid? I don't see how this could happen unless something in your code is doing it. If it's happening and it's not your code, then it's obviously a bug.
4) I don't understand the question. The column header has to be the same width as the column. You can't size one without the other.
What version of the components are you using? I recommend getting the latest hot fix before you do anything else, as their may be fixes which correct some of the issues you are having.
Mike,
Thanks for the fast response:
1. The group by row I refer to is the rows on the Display Result screen capture where it said "Friday January 22, 2007 - 1 Record". This row is missing from the PDF export.
2. Is there anyway to set the width of the grid instead of setting each column's width individually? Or is there a way to simply let the system autosize the cell and column based on the content and header text? Currently the cells with long text content will become wrapped in two lines and the child band does not resize at all - all cells & columns become about 10 pixels wide each.
3. Now that you mentioned the code changes, I checked back and realized that the original column 9 and 10 from the dataset was hidden and replaced with two unbinded column that has a calculated value based on column 9 and 10. I added the two unbind column in the code. Is there any way to make the added column shows up in the same position and span exactly like the hidden column that it was supposed to replace?
4. When I designed the layout in the UltraGrid designer, I can place the column label on the left of the cell (see screen shot), and the label's size is not the same as the cell. You can see that in the "Display Result" screen capture where column 5, 7, 9, 10 and 11's header width is smaller than the corresponding cell on its right. I would like to size the column header (or "label" so it was called in the grid designer) and make it smaller.
I've used the latest 8.1.20081.2033 hot fix on the project. Thanks!
1) All I see in this image are column headers. Where is there a GroupByRow?
2) The AutoSize property on the UltraGridDocumentExporter auto-sizes all of the cells and rows by default so they will fit the contents. If this is not working, it's a bug and you should Submit an incident to Infragistics Developer Support
3) Yes, you would have to copy all the properties of the original column to the new column. Mainly the LayoutInfo properties on the column.
4) I don't understand what you are asking here. You say you made the labels smaller than the cells and you appear to be asking how to make the labels smaller, which you have already done. You just click and drag the edge of the label in the designer.
1. From the UltraGrid Display Result on the right, on top of the columns you will see a blue text "Friday January 22, 2007 - 1 Record" with an expended row expender next to it. That's the group by row I'm refering to.
2. After setting the AutoSize property, I'm now managed to get the parent table resized correctly, but the child table is still not being resized. Are you able to reproduce this issue?
3. Thanks, I'll give that a try.
4. I was able to make the lable smaller in the designer, but when it was displayed on the screen (and for print out as well), the lable got resized automatically. Is there any way to keep the label from resizing?
5. Can you provide a small sample code showing how to manually set the width of the column?
Thanks and sorry for the confusion on the questions!
1. Okay, so the originalquestion was that thePDF export is not showing the GroupByRow? I don't understand why that would be. The exported document should look just like the grid. There's no reason why the GroupByRow would not show up unless you are doing something to turn off grouping in the export.
2. AutoSize should resize all columns in all bands. Again, I cannot see any reason why this would not work.
3. Okay.
4. Without knowing why the label is resizing, I can't really guess who to fix it. Maybe you are losing your design-time layout at run-time because you are loading a layout? That's just a wild guess.
5. In RowLayout mode, this can be tricky. There's a complex interaction between several properties like the Width of the column and properties on the LayoutInfo of the column like PreferredSize and WeightX.
1. Do you have any guess reason why it's not showing the group by row? Here are all my codes related to the export:---------------------------this->ultraGridDocumentExporter1->AutoSize = DocumentExport::AutoSize::SizeColumnsAndRowsToContent;this->ultraGridDocumentExporter1->Export(this->ultraGridDetails, save->FileName, DocumentExport::GridExportFileFormat::PDF);
private: System::Void ultraGridDocumentExporter1_BeginExport(System::Object^ sender, Infragistics::Win::UltraWinGrid::DocumentExport::BeginExportEventArgs^ e) { for each(UltraGridColumn^ c in e->Layout->Bands[1]->Columns) c->PerformAutoResize(PerformAutoSizeType::AllRowsInBand, true); }
--------------------------The BeginExport action is there because Child band will not resize correctly even after AutoSize is set.
2. Do you have any suggestions to look at any places or property I should check during debug to see why it's not working?
4. I never loaded any layout at run time, and the label is resizing. What I did tried was while the program was running, I manually adjusted the layout and saved the layout file manually using SaveAsXml() function, and then I modified the code to load the saved xml file at run time. That seems to be a temporary solution at the moment. However, I just can't get the design time layout (especially the label size) to show up on run time be itself.
5. If it's that complicated, I think it's not feasible to do it in code manually, since the layout might be changed in the future deployments.
By the way, is there any way to allow arranging the print and export layout at run-time by drag-n-drop?
Thank you very much for your time in this matter!
1) No, I really don't. I'm not sure I even undertand how what you are describing is possible. You are saying that the exported PDF includes the child rows with no parent row? There's no reason I can think of why that would happen. I can't even think of a way to make that happen if you wanted it to.
2) The only thing I can think of is that the autosizing may not adjust the width of a column when CellMultiline is true in order to avoid situations where Memo fields with a lot of text become way too wide. But that doesn't sound like the case here.
4) How are you setting the DataSource of the grid? Are you calling the SetDataBindingMethod. This KB article might help:
HOWTO:How can I define columns in the grid at Design-time and bind them at run-time so that some fields of the data are excluded from the grid?
Chris X said:By the way, is there any way to allow arranging the print and export layout at run-time by drag-n-drop?
You can Submit a feature request to Infragistics