How to write formula to grow all dynamic text field in crystal report - crystal-reports

Hi Experts,
Is there any way to automatically grow the content of dynamic text
field in crystal report. I will give you an example this way.
I have values to display in crystal report as (which we fetch dynamically fromt the database)
Employee_ID, Employee_name, Employee_address
Now, the Employee_ID, Employee_name would be ok. But for
Employee_address the value can be anything from the database, i.e. it
can be lengthy also(like with 80 charectors also). That is it will come in next row and
overlap the below the row column ('address') value.
Now, is there any way(or formula), when one dynamic text field grows
like address, then previous two Employee_ID and Employee_address
should grow automatically and for next row the data should not overlap
also.
Please give ideas.
Thanks in advance.

If you mark the three fields can grow, then each field will expand (vertically) as necessary to accommodate the data. If the field does NOT need to expand, it won't. Moreover, if the three fields are arranged side-by-side in the same details section, there will be no overlap--either horizontally or vertically.
If you are trying to always bottom-align the three fields, regards of the vertical size of any of the fields (the address field in your example seems to be the issue), then you have a different problem:
Relative Positions
This option allows you to lock the relative position of a report object next to a grid object within a section. For example, if you place a text object one centimeter to the right of a cross-tab object, during report generation the program will push the text object to the right, so that the one centimeter space is maintained regardless of the width of the cross-tab object.
Note:
Only horizontal locking is possible. If you need to preserve relative vertical positioning, you should create a new report section.
Once Relative Positions is selected for a section, you can no longer drag objects to new positions within that section. To change an object's position, use the Object Size and Position dialog box.
Relative positioning applies only to objects placed to the right of grid objects (that is, objects that can grow horizontally).

Related

Can a child text box grow with parent rectangle in SSRS

I have a rectangle with 2 subreports in it. I am trying to have a "header" text box to the left of the two reports that grows with the rectangle so that the "header" stays centered with the content. Current Arrangement
Desired Arrangement
I'm not sure how you have constructed the table/rectangles but this should work...
There is almost certainly a better way of doing this but this does work...
First insert a table. Delete the last two columns so you only have a single column left.
Then Delete the header row, you'll have a single cell remaining.
Now go to the Row Groups at the bottom of the screen, click the drop down and choose, "Add Group" --> "Parent Group".
In the dialogue, type 1 in the Group by field (this is just a dummy value) and select "Add group header". Click OK.
Optionally, you can right-click the details group and delete it. Select Delete Group Only when prompted.
Now the left column is merged so you can put your header text in there and set Vertical Align to "Middle". Add you sub reports as required and it will always be centred. Sere's some examples with different sized sub reports.
and finally with the text rotated which if your header is short and be formatted in a large enough font, sometimes looks better.
I left the ugly border in place so you can see the positioning more clearly.
Create a table with two cells. Your header cell on the left and a blank cell on the right. Then create a second table with your data. Drag and drop it into the blank cell.
The grouping in the parent cell will apply to the child cell in the table. The parent table's dataset will override a different dataset in the child table (which I doubt will cause any concern for you).
To make it look right you will want to remove the outside borders of the child table.

Jasper report, approach to create table

I have to create the following table
Where:
(Vx) means that it's a variable retrieved from a JSON dataset ($F)
Infox and SubInfox means it's a resource field ($R)
Actually i tried the Table and CrossTable components but they seem to be used for presenting recurring data (like sales per months...).
What I also need it's that a line's size should dynamically change depending on the text size (coming from resource fields or variable fields).
Should i use rectangles component and lines component to obtain that result (which can be pretty long...)?
No. You should use the Stretch Type property with the value Relative to Tallest Object and Stretch With Overflow with the value true set to all the fields in your detail band. You should also set the Position Type property to float for all the elements in the detail band and all the elements in all the bands under the detail band. This will allow report rows to stretch as necessary. Note that this might not entirely work for XLS and XLSX, see Stretching of cell in XSL export of Jasper reports

Overlapping Text in Crystal Report

I am working with SAP Crystal Report 2012. I am suppose to create a Crystal Report which may be exported to PDF. It has certain fields with "Can Grow" property. As a result of all this I am facing overlapping text issues due increase in the text length, I do not want to limit the length of text fields.
I have already tried keeping fields in the different sections. It did removed overlapping but it duplicated the fields as there is a grouping applied in these fields and thus hampered the whole format.
Here is the image of the required format with overlapping text:
Here is the result of applying sectioning on the report as I said it did removed sectioning but duplicated the fields:
just keep your original layout and do this. Put you pointer over the margin and drag it to the left to create a section under your growing field. In that way the field can grow pushing down the section below. See below picture.

Y position while composing a PdfPTable

I'm building a pdfptable thru ItextSharp, but I need to know, while I'm adding cells, my Y position in the page. Cells have a variable height.
I need to know it to avoid tu put a new 'Breaking title' in the table if this would go on the last table row, as it should go on a new page (on cust request).
I tried writer.getverticalPosition() but it seems not reliable in composing a table.
Is there a way to know it ?
There's a contradiction in your question. Let me explain what doesn't make sense.
You create a PdfPTable, let say you have an object named table. when you add cells to table, the object grows. Plenty of data is stored into memory.
Now you say: I want to know the Y position of the rows on the page while I'm adding cells.
Which page? There may not even be a page? As long as you build the table object, there is no page, there are no Y positions. One table could be 200pt heigh when added to a page with a width of 400pt. The same table could be 400pt heigh when added to a page with a width of 200pt. It isn't until you add the table object to a Document that the table gets its shape.
If you want to make sure a "title" isn't the last row on a page, you should break up your table in smaller parts. Create a subtable and add it to the document. Now use getVerticalPosition() and check how much space is left. If there isn't sufficient space for the first X rows of the next subtable, move to a newPage() and add the next table there, otherwise add the table on the current page.
If you define the widths correctly, nobody will see that you've been adding more than one table: it will look as if you added one large table instead of different small ones. If you don't know how to calculate the height of the rows in the subtables, please note that you need to define the total width of the table and lock the widths. For the reason explaiined above, no software can calculate the height of a table if it doesn't have any info about its width.

iTextSharp and moving some data to next page

I am creating an invoice using the iTextSharp. That displays nicely but sometime, when invoice items are larger in qty, the summary portion (which displays subtotal, tax, discounts, grand total etc) is splitted. Some displayes in current page and some moves to next page. I was thinking to move entire summary portion into next page, if current height left is not enough for that.
However, to do that, I need to know that how much page height is left (after my current page content rendering). I wonder if someone know how to calculate current left height of the page? OR if there is a property in the pdfPTable which may force the table to print itself as a whole and dont let it split across multiple pages! I guess if second option is available, it will be easy.
In summary, I need to know if it is possible to calculate remaining page height, and also if that is possible to force a table to NOT split across multiple pages.
thank you.
Sameers
You can set SplitLate to false to avoid auto page break in a cell data exceeds limit.
......
table.addCell(cellData);
table.SplitLate = false;
......
I suggest you use a nested table for your summary section. I don't believe iText will split a given cell on a page boundary, so everything in that cell (even if its a nested table with cells of its own) will stay on the same page.
Use the table's cell's row span so it takes up an entire row on its own.
I'm not certain, but I'd wager a beer on it.
What object are you using to add your data to the PDF? MultiColumnText, Paragraph, Phrase?
You should be able to use Document.PageSize.Height property to return the height of the Page.
Then use PDFPTable.Height to return the height of your table.
So just use the logic Document.PageSize.Height - table.Height, and you'll have the remaining y-axis space available.
The PDFPTable object has properties named SplitLate and SplitRows. I believe you can use these properties to try and keep the table on one page.