Can i make columns of my section in crystal report? - c#

i am working in Crystal Reports for VS2010 with asp2.0 .net, can i make the columns of sections, as i have columns of my tables, and i dont want to overlap, as with labels, they overlap some times.

I am not familiar w/ the VS2010 .net interface, but if it is the GUI, you can set insert tab-stops at the desired spacing. The fields will "snap" and anchor to the tab-stop line when you move them. You can shrink/grow each field so that both left and right sides are anchored, constraining that field. You can then take the next field, and anchor it's left side to the right-side tab-stop from the last field, and repeat. When you're through, all fields will be nicely constrained, and you can adjust the placement by moving the tab-stop. The fields will "rubber-band" and grow or shrink w/ the movement of the tab-stops.
This is REALLY good when you need to export to Excel format, and you don't want the CR print engine to include extra lines/columns as it tries to match the "just a little off" layout.
I "think" I need less "air quotes" and more "air guitar".

Related

C# PDFSharp and MigraDoc generating a table without wasting space

I recently started a project using PDF sharp + Migra Doc and I encounter a problem which I have seen in other posts, there is no fixing automatically. Table row will be generated on the next page if it doesn't have enough space and if there is still not enough space it will just go into the border and the text is lost. I am thinking of a workaround but I am not sure exactly how it can be done.
My think is as follows:
If I am able to check how many lines of text can fit in cell with the given string I can create a variable and increase it every time I add text. with the excess of text I can simply create a new row (which will be automatically be added on the next page) and thus fixing my problem. Even if I am not counting lines, is there a way to check if the row becomes too large for the current page? If at a given time I can check if the cell is too large and will be automatically sent to the next page I can trim the string up to the point it will fit, save the remaining words that didn't fit and maximise the space within the page.
this is how the document is generated currently
Is there a way to workaround this? That white space is useless and a waste of resources when it comes to a 30-40 pages document.
One extreme option: Make the layout in your code and use PDFsharp to draw the text.
See also:
https://forum.pdfsharp.net/viewtopic.php?f=8&t=3192
A MigraDoc cell can contain a mix of different fonts with different font attributes (regular, bold, ...) and sizes. Measuring the size and creating a new row can become complicated if you mix different fonts, but it can be simple if you only use a single font for your cell.
See also:
https://forum.pdfsharp.net/viewtopic.php?f=8&t=3196
The space problem with tables occur if table rows are rather large (more than just one or two lines of text). Maybe tables are not the best option to present the information. How strict are your requirements? Can you get away from tables?
The solution that finally worked was as follows:
set up the style for the document including the header
depending on the data used create a for-loop which will input the desired rows in the table
top of the loop must add a row in the document
save in a variable how many pages the document currently contains(initially declare as 1 before entering the loop)
clone the document checking if the document you are passing contains the same number or more than the current document. If the document contains more pages means that the row you inputted exceeds the page. I was able to achieve this by rendering the document every time I was adding a new row.
an inner loop is necessary to trim the text within the row. The way I did it is split the text into sentences and if it contains more than 3 sentences trim, otherwise just let go to the next page.
make sure you always delete the last row on the inner loop otherwise you will end up with the same data
It might not be the most efficient way but it renders 30+ pages documents in tables under 2 seconds on Azure servers. I hope this helps someone at some point.

C# string.Format alignment issue

I have a problem with the alignment of a few names (changed for this question).
with this code I display the names in a richtextbox where it should be in one row with the "Spalte:" after the Names...but it doesn't. Can anybody help me please?
(only the first for-loop is necessary for my question, the next one does another job)
I added a pic what it looks like and how it should be looking. I know I can do it like its in the commented area (doesn't work in every case), but I need to change the code for a few other things so this needs to work....
Here is what I have:
And here is what I want:
Thanks for helping me :D
You have four options:
Change the code for the RichTextBox to use a fixed-width font. Most fonts have variable widths for each character, meaning you can't line things up neatly based on spacing alone.
Use tabs instead of spaces for the layout (and make sure the tab size is large enough to account for variances in your text).
Use a grid control of some type (DataGrid, GridView, etc)
Use a custom control for each row with labels at specific places (and either calculate positions yourself to place them on the form or use something like a FlowLayoutPanel).

Crystal Report Layout issue

I am designing a Crystal Report in Visual Studio 2012 and can't seem to manage the position of a vertical line. I need the line to stick the right edge of the page, but it resists. Even if I managed to align it on the right, it displays at a different position after deploying the software on another machine, even when just previewing.
Setting the page size to A4 doesn't help. How can I make this easier on me?
Designer View:
In Report preview the right hand side line is not shown properly:
If I move the line a bit to the left, like this...
...the row background goes beyond the line in preview.
You might have better luck using a Box object for the outer layers and only using lines for the inside columns. Just like the lines, the Box can span multiple sections and will resize vertically if the report has extra lines added in. At the very least this will make sure the outside borders always connect perfectly.
If you're still having problems with precision, try setting the Size and Position. Set the Left and Top to zero, and calculate the appropriate Width value based on the Width of your report.
In the end Crystal reports are a little finicky when it comes to layout, and different viewers/printers might jostle stuff around a little. But unless the report has a dynamic width, you should be able to get it pretty close with a Box and very specific Size/Position values.

how to manage space between growing parameter fields in Crystal reports?

In a Crystal report I am passing two text strings from C# application. Both parameters are text string paragraphs basically which can have any no of words in them.
The issue is I am not able to manage spacing between both paragraphcs. As they are dynamic I can't fix their hieghts. If there is more text passed one top paragraphc over laps the bottom paragraph but if there is less text in top paragraph report shows big area as empty space.
What ever the amount of text may be, the requriement is paragrachs should have constant space between them (two line breaks). Please guide me how I can manage it.
Thanks
Put these fields in different subsections.
Put those Parameteres inside a Text Object and then set Can Grow property of the Text Object as True.
Try this and get back with your results.

Simple Custom Grid Control

I'm designing a Point and Figure Charting program, and my first version used the DataGridView control, which I found to be too big and bloated for my needs. All I need is a simple control that displays a square grid which will be filled with X's and O's.
The data is parsed from yahoo finance as Open, High, Low, Close data, sorted by a set of rules and converted to an Int Array, which will correspond with the index of the rows, so the simpler the control is, and the less bloat is has the more efficient it will be when chewing through large amounts of data.
I also need to be able to easily adjust the size of the squares in the grid, to zoom in and out of the data.
I am unfamiliar with creating custom controls (But willing to learn), and I'm not having a lot of luck with the search terms I'm using, so any help pointing in the right direction would be appreciated.
I've implemented a couple of custom controls like this before usually colour/graphics related stuff and they usually end up being more work than you imagine.
In the last project where I needed to do custom display stuff (a massive matrix of TCPConnection status between many different machines) I just used Xceed's gridControl and dynamically added the columns to the control. I kept an internal dictionary of the index of the column I added so that subsequent rows could benefit from direct reference to the column.
There are many different grid controls that you could probably utilise. Or if you want to get down and dirty with a Custom Control using the *Pain*t stuff you can do that too.
property for Columns, Rows .. Calculate the Space available then draw your Horiz/Verticals then draw you other values in the correct spaces, but eek prepare to invest quite a bit of time getting it "just right"

Categories

Resources