Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a table with columns, where i need to align numbers to center, with left justified.
I know i can do this using padding by left alignment, but this will be burdensome if there are multiple columns with different width.
Is there any option in NPrinitng to this?
Hi Supriya,
If you want to automatically change the padding depending on the width you will need to do it in script.
If you have two fields in label1 & label2 like this:
Open the Scripts Editor
Here is example C# code for label1:
private void label1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
XRLabel label = (XRLabel)sender;
int lx = label.Width;
if (lx < 50) {
label.Padding = new PaddingInfo(0,0,0,0);
}
else if (lx > 250) {
label.Padding = new PaddingInfo(75,0,0,0);
}
else {
label.Padding = new PaddingInfo(25,0,0,0);
}}
Adjust as required and repeat for label2 as well. You will get padding based on the width of your label (see arrows).
HTH - Daniel.
Hi Supriya,
I assume (based on your previous questions) that you are using PixelPerfect.
Won't one of the Text Alignment options (perhaps Middle Left) serve the purpose?
HTH - Daniel.
Its partially helping me.
see this images
Check the properties i am applying, where i need to give left padding to each column if they of diiferent width to make it to center.
I need it to take Automatically to center left align.
Hi Supriya,
If you want to automatically change the padding depending on the width you will need to do it in script.
If you have two fields in label1 & label2 like this:
Open the Scripts Editor
Here is example C# code for label1:
private void label1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
XRLabel label = (XRLabel)sender;
int lx = label.Width;
if (lx < 50) {
label.Padding = new PaddingInfo(0,0,0,0);
}
else if (lx > 250) {
label.Padding = new PaddingInfo(75,0,0,0);
}
else {
label.Padding = new PaddingInfo(25,0,0,0);
}}
Adjust as required and repeat for label2 as well. You will get padding based on the width of your label (see arrows).
HTH - Daniel.
Thanks Daniel,
This works fine.
I digged up some information on NP with scripts.
i have some questions regarding scripting in NP
1.) Can we use Winforms or ASP.Net controls in NP also?
2.) Can i connect NP to VisualStudio and is it any useful?(i know it sounds silly,need to know some information)
3.)Can we create table Programmatically and put that to NPrinting End user display?
4.)Currently i get script option to visual basic,c#, js. If i need to script with other language like java what should be done?
Hi Supriya,
1), 2) & 3) As far as I know the answer is "No"
4) Only C#, Visual Basic & JScript .NET are supported
HTH - Daniel.