I have array of strings and i want to add an empty line of lesser size between some of them.
So i have a code:
const _n=#13#10;
//...
r1.Lines.Clear;
r1.SelAttributes.Size:=18;
r1.SelText:='TEST';
r1.SelAttributes.Size:=6;
r1.SelText:=_n+'............';
r1.SelAttributes.Size:=18;
r1.SelText:=_n+'test1';
r1.SelAttributes.Size:=6;
r1.SelText:=_n+' ';
r1.SelAttributes.Size:=18;
r1.SelText:=_n+'test2';
and size change works for first line (with dots), but line between test1 and test2 has same size as they (18) somehow =\
Any suggestions?
I found some workaround: it's possible to use tab-symbol in place of space.
So the following code works fine:
r1.SelAttributes.Size:=18;
r1.SelText:=_n+'test1';
r1.SelAttributes.Size:=6;
r1.SelText:=_n+#9; // <- tab here
r1.SelAttributes.Size:=18;
r1.SelText:=_n+'test2';
Instead of inserting empty lines you could change the line spacing of individual lines by sending EM_SETPARAFORMAT messages to the Richedit. See this question
How to decrease line space of tRichEdit
for an example. To increase the line spacing change the value of "Para.dyLineSpacing". Use "500" to get an idea of the effect.
Related
I am trying to create a vertically centered line inside normal text. I also want to control length and width of the line as the dash or "---" are to thin and/or short.
I want something like the math-command \rule{length}{width}, which is centered like a dash and not floored.
Example (not created with Latex)
Simply put, \rule can be raised just by specifying how high you want it.
\rule[0.5ex]{1in}{0.4pt}
raises a \rule{1in}{0.4pt} 0.5ex above the baseline.
I'm printing an adhesive label (6x5cm) with a printer model 3nStar RPT006.
In the adhesive I am printing a title, QR code and the QR code in text
something like this
My Title
▄
qr code
Using this class as reference, I'm doing something like this:
initialize(),
setJustification(Printer.JUSTIFY_CENTER),
'My Title',
feed(),
qr(qrText),
feed(),
qrText,
feed(2),
cut(Printer.CUT_FULL, 1),
My problem is: I don't know how to control the vertical size, or how to set the height of the paper. Between each label I have a gap of 3mm.
So my question is, how should I handle the vertical spacing/height?
Currently I very close to get a perfect label, but seems like the printed label is some millimeters shorter and each time I print a label, it miss a little bit more, so there is a time where I start to cut the adhesive part and not the gap
I'm not sure if it's possible in your environment, but there are three options.
Prepare blank image data with the required number of vertical dots and print it(graphics(EscposImage $image, $size)) instead of the line feed code.
Use setLineSpacing($height) to change the height of one line only for the required part and start a new line. Then return to the original size.
Make your own customization by adding the function to feed the paper in dot units to the library for printing.
ESC J
I'm starting to think is not possible? (out of the box/default class)
I am using FPDF/FPDI PHP class to generate a .pdf
In this situation, I have some text that can be short, or be long (no telling)
So I set a width on my cell.. and change from Cell() to MultiCell()..
This allows long text to wrap.. however it seems to vertically align to the top?
Which is no good if the string is NOT long enough to wrap..
How can you force the text to the bottom of the cell regardless if it is a single line or a wrapped line?
Is there a default way to do this?
I saw mention of TCPDF (or whatever).. and some dead links to 'plug-ins'.. (but not sure if they were FPDI or not?)
This works and looks fine:
$pdf->MultiCell(185, 12, 'ABC-123-DEF-456 And-Last-Name-Here', 1, 'C', false);
However this way, does NOT have the (single line) text at the bottom.. so there is a cap between the string output and the 'underline' it shoudl match up with with (baseline)
$pdf->MultiCell(185, 12, 'ABC-123 DEF-456', 1, 'C', false);
How do you overcome this?
I think, I just found solution.
As default FPDF class I use this code: https://github.com/Setasign/tFPDF/blob/master/tfpdf.php (it supports UTF-8 chars)
Than have edited this class code: http://www.fpdf.org/en/script/script52.php
In Function drawRows() I have changed this row:
$l+=$cw[$c];
To this:
$l+=$this->GetStringWidth($c)/$this->FontSize*1000;
And than use drawTextBox() as is descripted in http://www.fpdf.org/en/script/script52.php
Now I will try to explain:
GetStringWidth() function supports utf-8 chars soo we can use it to calculate char width. And than we can get correct value with some multiplications and divisions for compability with that fpdf class.
I didnt test this code extensivly... only basic testing.
You can do it with a new line, "\n". But you need to keep in mind that cell height needs to be determined by number of "\n", as multi_cell will increase cell height automatically when required.
This is how I have done it:
spacing = " \n\n\n\n\n\n\n\n\n"
contents = "\n" + "hello" + spacing
pdf.multi_cell(10, 3, contents, border=1, align="R")
This will align "hello" to the top right corner.
When creating the spacing I added a space before the \n's otherwise it will be very close to the edge. I also added a \n before the "hello" as otherwise it will be too close to the top. I kept the multi_cell height to 3, but you can even put it to 1 or anything that makes sure your size of \n's is not smaller than the cell height.
I know this is very gimmicky, so if you have a better way please let me know.
This seems could be the answer:
http://www.fpdf.org/en/script/script52.php
Unfortunately, at least to me, it doesn't seem to work when using UTF-8 characters.
Is there a property that will apply the proper character spacing to have all the text on each line in an NSAttributedString butt up against the bounds like in a book, (including the final line which I know isn't done in books)? I know kerning can be adjusted, but that won't dynamically adjust on a per line basis. Any help would be appreciated. Also NSTextAlignmentJustified and NSTextAlignmentNatural get close, but won't apply the effect to the last line of text.
The only option is to use NSTextAlignmentJustified. Last line is never justified, because NSTextAlignmentJustified refers to Left Justification mode, as it is the standard case.
For more information you can take a look at Typographic Alignment on wikipedia : http://en.wikipedia.org/wiki/Typographic_alignment
How can we set the space between lines in an rdlc textbox?
Scenario:
The application shall be printing a report to a pre-printed stationary sheet.
One string field of the report is usually having about 400 characters of data (description input by user), which shall be printed in multiple lines.
As a workaround to the problem of not able to set LineHeight property of textbox control in rdlc, I have written a custom code which will insert new line characters into the string (by adding Environment.NewLine) such that the string is splitted into multiple lines. However, I am not able to set the space between each line in the text box. I have tried setting both SpaceAfter and SpaceBefore property. No change :-(
I also tried using VbCrLf and combination of Chr(10) and Chr(13) instead of Environment.NewLine. Did not help... Can you help!!!
I am using VS2010 Premium Edition and Application Target of 4.0 framework.
I added new textboxes for each lines to my report and set position for them with necessary line spacing.
because Line spacing in textbox properties is not applied.
This is how I do it. (It works only between paragraphs, not within a single paragraph where the lines wrap.) Say the font is 12 pt, and I want a little space between paragraphs, but not full double-spacing. I put the extra line between paragraphs, and then I select that empty line and set the font to 6 pt. If I wanted 1.5 spacing, I'd set it to a larger font.