I need to display a long string in a TextArea in the form of two columns. Say 20 characters of the string in left side and then some space and then 20 character on right side of TextArea. At next line again I am doing same thing till my string is complete.
But what is happening is like at right column all rows are not aligned exactly. This is happening because each character has different pixel width so alignment of right column depends on character printed on left column. if on left column characters are like 'iiii' then second column row starts a bit early in TextArea and if on left column, characters are like 'MMMMMM' then second column row starts a bit late.
I am using <textFormat> tag for text formatting into this string.
Try setting the fontFamily of TextArea to Courier New.
fontFamily="Courier New"
Related
How do I properly indent paragraphs within lists in bookdown? I would like to start a new paragraph after a blank line as show in the example below. This example works for RMarkdown when used outside of bookdown but breaks down when used with the bookdown pacakage.
First ordered list item
You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
Another item
Unordered sub-list.
Actual numbers don't matter, just that it's a number
Ordered sub-list
And another item.
If I render the following code to pdf then I get the output you listed above. Note the spacing and white space. After the numbers there are two spaces (for a full indent of 4). After the bullet there are three spaces.
1. First ordered list item
You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
2. Another item
* Unordered sub-list.
3. Actual numbers don't matter, just that it's a number
1. Ordered sub-list
4. And another item.
The result looks like this
I am receiving currency as a string from an API, and it looks like this : "USD 10,000.00", I can have "USD 10.00" etc.. What I want to accomplish is to align the currency ISO code to the left of my table, and the value to the right - not the column right, but the longest string right, as shown in the example below.
Image of the desired solution
The table flexes so that all columns are the same size, and that is why I need this functionality. My thoughts for now are that the total sum will always be the widest element and we need to get it's width, but since my framework restricts onload() methods, I can't wait for the total element to render, thus giving me 0 for offsetWidth when I load the table for the first time. Any ideas, thoughts?
You could split the formatted currency into two parts with a regex, and then use two columns to display the formatted amount, with text in the currency code column left justified, and text in the numbers column right justified.
I've just been trying unsuccessfully to get phpexcel (PHPExcel_Writer_Excel2007) to automatically adjust row height based on content, when that content contains newline characters. At the moment, only the final line is visible. I've tried setting the row height to -1 for the row in question and the whole column i.e.
$objPHPExcel->getActiveSheet()->getRowDimension(65)->setRowHeight(-1);
and
$objPHPExcel->getActiveSheet()->getDefaultRowDimension()->setRowHeight(-1);
but it makes no difference. Help appreciated. Cheers
I have tableView with first column for row number. I would like to set CONSTRAINED_RESIZE_POLICY for all columns without first.
I made:
//First column implementation
column.setPrefWidth(40);
column.setResizable(false);
... //Make other columns
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
So I have first column with width I chose but other are wider than without last line in code above but still there is one additional void column.
And I have another question because I looked for resizing column to length of the longest text in column (I need it for first column) but I only found old answers with very long and tricky solutions. Is there any simple solution (method) to do it?
Edit: I found that when I try to manually resize columns, that they resize properly (as they should with CONSTRAINED) after only click to resize one of columns so I have a question, why they didn't resize from the start like I described above but after trying to manual resize. I think that problem is with setResizable false on first column but how can I repair this?
I found solution. To make other columns CONSTRAINED_RESIZE_POLICY there must be set size of the first column like below:
column.setMinWidth(40);
column.setMaxWidth(40);
and it's working without line setResizable(false).
I have a QTableWidget that is used to display lots of data, basically derived from a function f(a,b). All a values go into the horizontal header, all b values into the vertical header and all f(a,b) into the corresponding cell.
The columns should be sortable. When a user clicks a column, all values in that column are sorted and all other columns are also "synchronized", since whole rows are sorted (using the clicked column as a sort criterium).
This works. Except for the "header column", the vertical header. The vertical header does not change, it does not synchronize with the reorganized rows. Is this the intended behaviour? Is it a bug in my code? How do I make the vertical header sort, too? Or do I need to add my b's to an ordinary column?
edit: I solved it now by making the header column an ordinary column. Though, I would still be interested in why the vertical header does not sort with the other columns.
Try to use QTableView instead of QTableWidget.
And use QAbstractTableModel for computing f(a,b)