问题
I am attaching an image to elaborate what i want to know
Crystal reports dont have any specific grid control
I have made a grid using textboxes in crystal reports 2011 for vs2010, But the problem is, if one of the column grows, i want to grow all text boxes of a row, as i have placed the grid in Details section of crystal report. In image attached, you can see, description's height increases because extra text and "can grow" checked, i want if description increases whole row's height should be increased.
I made the columns using textboxes because if i use box or other rectangle control, it has very bad layout, i hid the textboxes right and top border, and joined all the fields together to make a row.
Thanks in advance.
回答1:
Crystals text boxes are awful, as shown above they do not format nicely and are not consistent. The below is not a brilliant solution; but our work around the produce consistent and nicely formatted expanding tables.
Instead of using text boxes I suggest you use normal boxes and line objects (graphic objects) instead.
Use one box as the outline to your table, draw it so it is at the top of the header and extends to the bottom of the group. This will then dynamically expand and give you a consistent border.
I would then add another details section underneath the main one. Fill it with a horizontal line extending to the box. This will then rule under each detail line. You can do the same in the header.
Draw vertical lines using the line tool, connecting the top and bottom of the outer box.
When placed correctly the lines and the box will adjust vertically in respect to your data. Make sure all sections containing a horizontal line are squeezed up so there is no "whitespace" surrounding the line. You can also supress the last horizontal line if you have problems with it matching up to your footer.
回答2:
Do not use borders of text box to make cell borders, instead use lines to create borders one horizontal line above the text boxes and one below the text boxes. both lines having width long as the detail section. and for vertical borders use vertical lines. that starts from top of group header section and ends at bottom of detail section. now when the height of cell increases when the content is large then all the rows will be set accordingly..
回答3:
If you remove the bottom and right borders, you can increase the height of the fields so that each new row, overlaps the one above and each new column overlaps the previous column... In the sample image below, I have moved MTP down and across by one notch each on the grid to demonstrate that it slightly overlaps the boxes above and to the left.. Move the top left label/textbox to the back (right-click->Move->To Back) and add each new control on top (working left to right, row by row), with a white background to cover the edges of the previous box.
I changed the grid size to 0.049cm (0.05) to get the best fit between the boxes.
I used Line objects for the last two boxes that are both CanGrow=True and I want them to be the same height.
Do not add a bottom border to the textboxes, add Line objects to the sides that overlap their borders (for guidance), set the lines' ExtendToBottomOfSection = True... then draw a final horizontal line below both textboxes that starts on one side Line object all the way to the other side and also set to ExtendToBottomOfSection = True. This will always draw the horizontal line at the bottom of the Details section, so that the last two boxes look like they are extending to the bottom of the section. (In the image I have shifted the right border off to the left a bit to separate the items)
This has to be at the end of the section. If you want something below, add a new Details section as the previous commenter correctly advised.
来源:https://stackoverflow.com/questions/8302398/how-to-grow-height-or-all-fields-of-a-textboxes-made-grid-if-one-columns-hei