Crystal Reports - Adding Arabic and English in the same field - c#

I'm trying to add a paragraph in English and another in Arabic in the same cell, is there a way to set the Horizontal Alignment and the Reading Order with different values?
can I use a delimiter to split them and set their alignment and reading order?

Take text field add english then add delimiter then arabic..
Place the field on design and enable can grow property

Coding a split formula to adding specific alignment for each paragraph won't solve the issue.
Referring to crystal reports documentation, one field can't have multiple alignments or reading orders.

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.

TextBoxGrid/Tabular View in winforms C#

Hi I need to make a text grid to display some data.
The requirement is as follows. The grid will always be n by n (a square).
Each cell in the grid needs to display 2 lines of data
1st line of each cell is a 3 char identifier like ABC Font size 8
2nd line of each cell needs to be 4 digit decimal number xx.yy Font size 6
Each cell background needs to be colour coded accoring to the xx.yy value Basically I need an excel style value based conditional formatting
I would like to be able to update each cell with a Control.Update (row,column, values) type function or a Control[row][column] = values type property.
So far I have looked at Gatagridviews but I cannot seem to find a way to implement multi line text entries with different font sizes
Before I decide to write my own control in C# and reinvent the wheel,is there a simpler way to do this. Please note I specifically need each cell to have 2 lines of text and each line of text has a different font size.
My approach will be to create NxNx2 text boxes and the play around with their formatting wrapping this entire mess in a class and then using it in a form with.
But as you can see if I am dealing with a 40X40 data grid this will result in 3200 text boxes. I don't think my approach is the best/correct way to go. Not to mention how difficult it will be to format this as a nice big Square.
PS. I have 0 knowledge of WPF and I have written most of my GUI in c# already

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).

Extracting the details of varied text formatting within a single SpreadsheetGear cell

I have some text in cells which are formatted in different ways, let's say:
"This is mixed style within a single cell"
I can access the text content and IRange's Interior property provides color data (among others), and IRange also have Style property which provides Font data, which can tell if the text is bold or italic. In my case however I may have different styles within a single cell. How can I extract that?
In VBA you would examine the Characters property of the Range object. Is there something similar in C#?

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.

Categories

Resources