TabStops definitions does not work in PdfSharp - c#

I am fighting with tab stops in PdfSharp but none I have tried worked.
I have finally this code:
Paragraph para = row.Cells[0].AddParagraph();
para.AddText(att.EventDate.ToString("ddd").Substring(0, 2).ToUpper());
para.Format.TabStops.ClearAll();
para.Format.TabStops.AddTabStop("0.3mm");
para.AddTab();
para.AddText(att.EventDate.ToString("dd/MM/yyyy"));
The calling to AddTab adds a normal tab, not the one I have defined.
Any help will be appreciated
Thanks
Jaime
EDIT:
what I need to achieve is to format a date with the 2 letters day name, for example, "MO dd/mm/yyyy". I need to use tabstops because I need all dates to be aligned, considering that day names will vary in width depending on the letters. 3 mm is good enough to achieve this.

Never mind... I have placed 2 column tables inside the date cells. That way I could align perfectly the way I want.
Cheers
Jaime

Related

Page header is not repeating in rdlc report when two tablix is having two dataset

I'm having a one strange scenario. Before going into it, I want to say that I'm very beginner to this rdlc report. Hence I'm struggling to resolve it.
What I want is ?
I want to show the page header in all the pages.
What I have is ?
I'm having one header part which is having few textboxes and the body part which is having two tablix. Here, the two tablix consists of two difference datasets. The first tablix is grouped under Group1.
What the issue I face is ?
The first tablix consists of 50 records, that occupies three pages. In all the three pages, the header part is visible. When the second tablix is coming into the fourth page, all the header part turned into # error. Really struggling a lot to solve this.
What I tried is ?
Opened Advanced Mode in the Groupings pane.
Clicked static and changed the Keepwithgroup = after and Requestonnewpage = true.
Note : I did this for the two tablix but nothing works. Also I'm not sure that this will give the way.
Also I checked in report xml file also.
Checked Repeat row on each page and Repeat column on each page.
Hope you understand my problem. Kindly guide me where I'm making mistake. Thanks in advance.

horizontal tab escape not working in string.Format [duplicate]

This should be very simple.
I have a Label control on my Form and I am trying to put a tab character between text
Label.Text = "Is there a\ttab";
The output is "Is there atab";
What am I doing wrong?
Tab is actually a non-printing character—or rather, a control character. What it does is entirely dependent on the application. What exactly do you expect? 8 spaces? 4 spaces? As many spaces as needed to get to a multiple of 8 columns? Indentation of the following text by one cm?
To put it short: The Label control doesn't support tabs. Actually, Label just uses normal graphics routines for rendering its text and how should they know what you intend to do with your tab character?
If you need to display that character as a number of spaces, then you should replace it by that number of spaces.
I wanted to add tabs ("\t") to a dropdown list of items. The items have a ToString method that gives about 3 words concatenated together. They did not line up. For example:
1-I 45
123-AB 511
123456-MMM 611
A long list like this is hard to read. So I used string.Format like this:
string.Format("{0,6}-{1,-4} {2}",id,name,num);
The number after the comma will right align/pad if positive and left align/pad if negative.
Then I changed my font in the Combobox to be monospaced, like Courier New, and you get something like this:
1-I 45
123-AB 511
123456-MMM 611
That is much easier for a user to read.
Nothing, windows forms labels are very limited in functionality and don't support the \t character.
A (slightly awkward) alternative might be:
label1.Text = "test\ting\t123".Replace("\t"," ");
Old thread, but since none of the answers seemed to work for me, I will go ahead and throw in my 2 cents. I could not get a "\t" or even use manual spaces to add spacing to the label. What I ended up doing was using alt code alt-255 5 times. This worked like a charm. Gotta love total hacks...
Right, to insert a tab, just add the spaces desired.
If you want to offset the next by a specified length, you could try
int offset_text = 20;
label1.Text = "Is there a".PadRight(offset_text)+"Tab";
label2.Text = "More Text".PadRight(offset_text)+"Too";
Just use a literal string and you should be good to go...
label1.Text = #"Test for Tab";
Where that big space is where I actually hit tab three times...hope this helps
I had the same problem. A textbox does instead a label accept Tabs. So if you change the label in a textbox, the pro
Just click in the arrow at the right of the Text property of the label (click in the Text property content and the drop-down-arrow will show up). A box for text-editing will open, and in that box you can use Enter, Tab, and so on.

Minus sign on DataGridView on RTL language

Whenever I use a DataGridView negative values in it display the minus sign to the right of the number and not to the left: e.g.: 4.5- instead of -4.5. My DataGridview is set to "right to left" mode because the language is Hebrew.
How can I sort it out?
Edit DataGridView Columns and DataGridViewCellStyle:
Format=#,##0.00;#,##0.00-, Alignment=MiddleCenter
If you have no luck with format strings (see Creating a custom format string in a dataGridView) have you tried explicitly rendering the numbers as strings and then displaying them? I believe that might be the quickest and easiest answer.

How do you programmatically break up one Excel document into several while still maintaining each cell's style and format?

m trying to break one large Excel spreadsheet into several. I've made good progress, but I'm running into some problems. Specifically, the values that get copied over don't retain their format (for instance, 40322 instead of 5/24/2010 and -101 instead of (101.00) ). I've tried using the style (see below) but that doesn't even get me the font, let alone the number format. Any help or a poke in the right direction would be appreciated.
There are 2 loops, one for row, one for column.
destinationSheet.Cells[i, j].Style = sourceSheet.Cells[i, j].Style;
Instead of looping for each cell, you can copy/paste the entire range of cells using the pastespecial method.
http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.namedrange.pastespecial(VS.80).aspx

Keep table in one piece MigraDoc / PDFsharp

I am using PDFsharp / MigraDoc to write tables and charts to PDF files. This worked great so far, however MigraDoc will always split my tables (vertically) when it should move the whole table to the next page in the document. How do I make sure the table will stay in one piece?
Table class of MigraDoc.DocumentObjectModel.Tables has a bool KeepTogether property however it seems to have no effect (either set to true or false).
Is there a way to do it manually? Is there any way to "measure" the distance from the end of the page and compare it to tables height? (Or any other way of knowing wether the table will be split or not)
Please note that I am using PDFsharp / MigraDoc for the first time. If there are any best practices I ought to know, please let me know. If there are some good examples out there (I saw those on PDFSharp's home page, but that's about it) I'd love to know about them!
You can set the KeepWith property of a Table Row to specify blocks that must be kept together.
If you know the table fits on one page, you can set the KeepWith property of the first row to (table.Rows.Count - 1) when the table is finished.

Categories

Resources