I need the character (square form) which entirely filled the charactere area and there is no spaces between two of these characters - vba

I need the square-symbolized character have the square shape that fills entire the character's area, (black).
Example: There where the character with (Alt + 196) ASCII code which is a line that horizontally filled the width of the character's space:
Here is 5 character of Alt + 196: ─────
So there is no space between characters.
I need this form for a squared character that fills the width and height of the characters space.
Regards.

Three Full block characters
ThisWorkbook.Worksheets("Sheet1").Range("A2") = String(3, ChrW(&H2588))
Horizontal Line (3 characters)
ThisWorkbook.Worksheets("Sheet1").Range("A3") = String(3, ChrW(&H2500))
ThisWorkbook.Worksheets("Sheet1").Range("A4") = String(3, ChrW(&H25AC))

The character is called the En Dash and it's code is 150. The way that I determined this is by using the Symbol Dialog to insert the it into a cell and then in the Immediate Window I used ?Asc(ActiveCell.Value) to get its Character Code. Chr(150) will reproduce the character and the String function can be used to repeat the it (e.g. String(5, 150) returns ───── ).

Related

Excel - Leading Space (??) visible in Cell but NOT in Formula Bar

In a cell the string "Usha" appears with what looks like a leading space, but in the Formula bar it appears correctly. Also, using LEFT(A1,1) returns "U" and not any other character. What is the cause of this behavior and what are the possible solutions (both UI and VBA)?
Check the indent of that cell.
Use the left of the red marked buttons to remove the indent.
Check the format of the cell. I pasted text into a cell formatted as "Accounting" and observed the leading space in the cell (e.g. ' ABC') but not the formula bar. Changed the cell format to Text and the space disappeared.

How the value of the tj operator is generated in a pdf document (justified text)

I can't understand and find how the value of the tj operator is generated??
Here I paste result before and after changes in the display of the text (on the second block I changed the position Left-Justice and then again comeback to Centered)
I think pdf use some of prng, but what kind of, I can't find
HElp please
[(\003\024\027\005\003\030\036\b)-114.267(\003\006\007\024\036\b)-113.297(\026\002\024\003\032\020\b)-113.337(\b)-111.574(#\024\002\f\005\002\021\003\007\004\f\005\b)-117.089(\003\006\002\003\b)-114.08
[(\003\024\027\005\003\030\036\b)-114.366(\003\006\007\024\036\b)-113.297(\026\002\024\003\032\020\b)-113.327(\b)-111.693(#\024\002\f\005\002\021\003\007\004\f\005\b)-116.98(\003\006\002\003\b)-114.188
First of all, the PDF format does not explicitly support text justification. PDF does not even know text column definitions to justify text in!
All the PDF format supports is
setting or changing the text matrix (and text line matrix), scaling, character and word spacing explicitly and
drawing text pieces which implicitly changes the text matrix.
Thus, if a PDF processor changes the justification of a line of text, it actually first has to have determined
which text pieces belong together and form that line of text;
text pieces can be given as arguments of the Tj or TJ instructions (or more seldom the " or ' instructions); in simple cases the whole line is drawn using a single instruction but you cannot count on that in general; and
what the left and right borders of the text column are to justify between;
e.g. these borders might be standard values assumed by the processor for certain page formats or derived from the current clip path.
Having determined these data, the procedure differs for different kinds of justification:
left justification - position the text matrix at the left text column border at the height of the line and simple let the text drawing instructions follow;
right justification - calculate the width of the drawn line using the current font, position the text matrix at the right text column border minus that width at the height of the line, and let the text drawing instructions follow;
center justification - calculate the width of the drawn line using the current font, position the text matrix at the middle of the text column minus half that width at the height of the line, and let the text drawing instructions follow;
full justification - calculate the width of the drawn line using the current font, set the character spacing and word spacing (using the Tc and Tw instructions, probably with a tweak of the Tz horizontal scaling) to use up the difference between that width and the text column width, position the text matrix at the left text column border at the height of the line, and let the text drawing instructions follow;
or calculate the width of the drawn line using the current font, change the text drawing instructions to use up the difference between that width and the text column width (e.g. using the numeric TJ array argument values), position the text matrix at the left text column border at the height of the line, and let the changed text drawing instructions follow;
or even apply a combination of these methods.
(The changes applied when doing a full justification - character spacing, word spacing, changes of text drawing instructions - obviously additionally are undone when later again changing to another type of justification...)
Positioning the text matrix can happen using the Tm, Td, TD, and T* instructions.
By the way, the positioning and scaling of the text also is influenced by the current transformation matrix. Thus, cm instructions can also be used for justification. But this is less likely than the use of the instructions mentioned above...
Unfortunately you merely supplied an excerpt from the array argument of a TJ instruction before and after such a justification job. One sees that the numeric elements of that array change very slightly. Whether this actually is the justification itself (as per the second option of the full justification above) or merely some computational inaccuracy cannot be told without the context.

openpyxl alignment indent vs ident

In my Excel file data in the cell is indented, and indent information is very important to get.
My code:
import openxlpy as opxl
wb = opxl.load_workbool('file.xlsx')
sh = wb.get_active_sheet()
r = sh.rows
c = r[10][0]
now the question:
c.style.alignment gives me two options (1) indent and (2) ident
(1) does NOT return correct indent information
(2) has correct number
what is the difference between the two? Is it normal for ident to have correct info.
thank you
[update]
openpyxl version is 1.8.5. Text is representing a tree, where each indent is next level. It starts with no indents and goes in increments of 1
I don't know what version of openpyxl you're using but ident has never been an alignment attribute. c.alignment is the preferred spelling. The specification defines indent thus:
An integer value, where an increment of 1 represents 3 spaces. Indicates the number of spaces (of the normal style font) of indentation for text in a cell. The number of spaces to indent is calculated as following:
Number of spaces to indent = indent value * 3
[Example:For example, an indent value of 1 means that the text begins 3 space widths (of the normal style font) from the edge of the cell.
end example]
[Note: The width of one space character is defined by the font. end note] Only left, right, and distributed horizontal alignments are supported.
The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.

How do we convert any special characters in textbox to certain format

I want to convert any special characters entered in infopath textbox into under score.Using the translate function, in the below example I am able to replace the space with under score
translate(fileName, " ","_")
Since translate function takes only three parameters then how can we check all the special characters? My target is if any special characters including space is entered into the text box it should automatically replace these special characters with under score ("_")
what if you reverse it. If it is not A-Z, then convert it
or try this:
translate(field1, "!##%^&", "_")

How do I check if a string has a paragraph character?

I need to check if a string from a word document contains a paragraph character. I want to only extract the text without the paragraph character. Is There a constant for the paragraph character? I tried checking for vbnewLine and vbCrLF, but these didn't work.
Have a look at the wikipedia article on newlines.
In total there are 3 characters indicating a new line (in some context), and sometimes they are used in combinations.
I think it does not matter which ones Word uses and which ones it doesn't; You want them all gone.
So, I'd say run through all characters and remove all LF, CR and RS instances, or replace them by spaces (whilst avoiding double spaces)