PDFBox - text align to the right - pdfbox

I am here again because of pdfbox. I want do something from this text:
A
AS
ASD
ASDF
to this:
A
AS
ASD
ASDF
How can I do that alligment?

Related

Pandoc Markdown to Latex PDF: table merges rows in single row?

Consider this example for test.md Markdown file:
---
title: "Testing"
author: Bob Alice
date: July 07, 2010
geometry: margin=2cm
documentclass: extarticle
fontsize: 12pt
output: pdf_document
---
Here is a test of a table:
+----------+-------------------+-----------------+
| Box name | Another parameter | The IP address |
+==========+===================+=================+
| Test 1 | random-string-01 | 10.0.0.20 |
| Test 2 | random-string-02 | 10.0.0.30 |
+----------+-------------------+-----------------+
If I convert this via pandoc:
$ pandoc --version
pandoc.exe 2.10 ...
... with:
pandoc test.md --pdf-engine=xelatex -o test.pdf
... the result is:
That is to say, "Test 1" and "Test 2" were compacted into a single row - even if the documentation is explicit about grid_tables:
https://pandoc.org/MANUAL.html#tables
Pandoc does not support grid tables with row spans or column spans. This means that neither variable numbers of columns across rows nor variable numbers of rows across columns are supported by Pandoc. All grid tables must have the same number of columns in each row, and the same number of rows in each column.
So, I can't really see how come it managed to merge these rows into one.
Is it possible to get pandoc -> latex -> pdf to keep "Test 1" and "Test 2" in each their own cell? And is it possible to get rid of the blank vertical space at the bottom of the table?
Grid tables use explicit vertical lines to separate rows. The fact that there are line breaks in the other cells is incidental, as the contents don't fit into a single line.
Use this instead:
+----------+-------------------+-----------------+
| Box name | Another parameter | The IP address |
+==========+===================+=================+
| Test 1 | random-string-01 | 10.0.0.20 |
+----------+-------------------+-----------------+
| Test 2 | random-string-02 | 10.0.0.30 |
+----------+-------------------+-----------------+

Use VBA in excel to extract first and last delimited substring (non-empty substring)

I have a column in which each cell contains data in this format:
ABC | DEF | GHI | |
ABC | DEF | GHI | JKL |
ABC | DEF | | |
I need to extract the first and last valid (i.e. not empty) sub-strings.
I can extract the first/last substring easily enough using a formula (though it's clunky):
FIRST SUBSTRING
=TRIM(MID(SUBSTITUTE(A1,"|",REPT(" ",LEN(A1))),(4-4)*LEN(A1)+1,LEN(A1)))
LAST SUBSTRING
=TRIM(MID(SUBSTITUTE(A1,"|",REPT(" ",LEN(A1))),(4-1)*LEN(A1)+1,LEN(A1)))
This basically uses SUBSTITUE to replace the "|" delim with spaces, then uses MID to the extract the nth substring followed by TRIM to replace the extra spaces... but if the last delimited substring is empty it returns an empty string (as its meant to i guess).
How can I modify this formula to extract the last valid substring (i.e. not empty " "). Could someone please show me how to do this using VBA code ?
ABC | DEF | GHI | |
Output column 1: ABC
Output column 2: GHI
ABC | DEF | GHI | JKL |
Output column 1: ABC
Output column 2: JKL
ABC | DEF | | |
Output column 1: ABC
Output column 2: DEF
let's say your worksheet is WS
and your values starts at cell A2 till A120
dim zeValue$, out1$, out2$
dim i as int
for i = 2 to 120
zeValue = replace(replace(WS.range("A" & i),' ',''),'|','')
out1 = left$(zeValue,3)
out2 = right$(WS.range(zeValue, 3)
debug.print('out1 : '+out1)
debug.print('out2 : '+out2)
next i
Not tested but that should work
Good luck pal !

Excel VBA- if cell contains text copy paste to another row (uneven spacing)

im relatively New to VBA and ive been asked to come up with a Macro(or in the terms given to me Automate) to filter all the rows in my workbook that contain "Total" & "Average" over a month long period and adjust the positions of 2 cells to be in line with another row.Now i can normally Filter what i need filtered but the problem lies in how i need to format it Exported. i need it looking from this
e.g
COL1 | COL2 | COL3 | COL4
Report Date:| xx/xx/xx | (BLANK) | (BLANK)
-------------
Service Group:| Repayments |
-------------
Total xx | xx | xx
-----------
Average | xx | xx
To this.
COL1 | COL2 | COL3 | COL4 |
Report Date:| xx/xx/xx | Service Group:| Repayments
--------
Total | xx | xx | xx
--------
Average | xx | xx | xx
the problem im having (besides being a completely new to VBA) is how to have it be "Automated" to which I had the idea of assigning a Macro to a Button which when pressed would cut Paste (then remove the blank space)every instance of (Service Group:) & (Repayments) up 1 row and over 3 columns
so for another Example: after the filter the rows would be Numbered variously so Starting on Position: B6 & C6 MOVE Up one and Over three to Position E5 & F5
Sorry for the Long winded convoluted explanation I tried to TLDR but i couldnt think of a way to better describe it. edit 1. Also the data is nonsequential

Format text in QTextBrowser in PyQT

I want to write a text in QTextBrowser in PyQt. I have something like this:
for line in working_data:
word = line.split(";")
self.ui.textBrowser.append("{:30}{:>30}".format(word[1], word[2]))
With this I get something like (left and right alignment):
ID Value
123 10,00
1234 20,00
1 330,00
12345 1,00
I would like to have it like this:
ID Value
123 10,00
1234 20,00
1 330,00
12345 1,00
How to achieve that? I looked here and tried {:30}'.format('test') and {:>30}'.format('test') for right align case, but it would'n reserve 30 places for a first word.

How to position color bar in GrADS?

I am looking for a code which positions the color bar by itself. Here is graph:
I used the set_pareas.gs script to fix the graphs in columns and color.gs script to color the plots. The color bar script is xcbar.gs. Here are the command lines
c
set_parea 1 3 1 1 -margin 0.8
color 0 12 1.2 -kind red->orange->yellow->dodgerblue->blue
d var1
set_parea 1 3 1 2 -margin 0.8
color 0 12 1.2 -kind red->orange->yellow->dodgerblue->blue
d var2
set_parea 1 3 1 3 -margin 0.8
color -12 12 2.4 -kind blue->white->red
d var1-var2
I would like that the color bar stay just below the differences map and red->orange->yellow->dodgerblue->blue color bar stay just below the orange maps.
You can adjust the position of color bar in the command of xcbar.
The below document maybe necessary for you:
http://kodama.fubuki.info/wiki/wiki.cgi/GrADS/script/xcbar.gs?lang=en