I am using XWPF to read .docx file which contain a table. In this table I get row then cell then I add a paragraph inside and in this paragraph I add multiple Run (with different style of font)
My question is (I know I don’t have posibility to get when word add new page or it is out of scope to me...?) But what I want achieve is get current height in my loop of the tableRow or tableCell is this possible? I mean something like this squelette code
XWPFTableRow r = ...;
For(...){
r.getCell(0).addNewParagraph(0).newRun().setText(...);
// at this step of programm I want height of each cell and each paragraph,
// is this possible? Because each iteration my table row height increment..
}
I tried tableRow.getHeight() to get row height but it get always 0, someone have idea to get row or cell or paragraph height?
Related
Setting up the UILabel on the attributes inspector as follow expands the cell and display the large text as multiple lines correctly for a Subtitle tableview cell:
Lines = 0
Line Break = Word wrap
But this doesn't work in a custom tableview cell for some reasons. In the custom cell, I added new labels and setup the attributes the same way but the cell doesn't expand.
It could be a matter of constraint.
Check to see if there are any conflicting constraints or fixed settings.
In order for elements of a cell to be set flexibly, the height of the cell must be set to the automatic value.
When I set it up like this, I was able to get the results I wanted.
I'm trying to add spaces in between rows in an NSTableView, like how it looks here.
Currently, however, my rows look like this, with 0 spacing between them.
Is it possible to add these spaces? I found this post on how to do it, but that's for UITableView, and I don't think you can add sections with NSTableView. Another thing I tried was using intercellSpacing on the table view, like so:
tableView.intercellSpacing = NSSize(width: 0, height: 80)
However, that just increases the height of each row rather than increase the space between them.
Lastly, I looked into drawSeparator, which seems promising but has limited documentation. Would extending NSTableRowView and overriding the drawSeparator method work, basically by drawing in a blank space as the separator? If so, how would I go about making my table view use my custom row view class?
If none of these options work, I'd also be open to faking the effect, maybe by having the actual content of a row be smaller than the row itself and using the remaining space as the padding between rows. However, I'm not sure if this would work, given that right now I'm using NSShadow, which highlights the boundary of each row.
Found a way to work around this issue. Before, each row consisted of two columns, one for the text fields and one for the buttons. However, I've changed it by putting all the text fields and buttons into a single column, that way there's only one cell per row. I then can apply the NSShadow and other styles to the NSTableCellView rather than the NSTableRowView. This means that I can now use intercellSpacing to create vertical spacing between cells:
tableView.intercellSpacing = NSSize(width: 0, height: 80)
The rows are still touching, but I've disabled the borders/highlighting on them so you can't actually see them. The cells, on the other hand, are visible, and you can adjust the spacing/styles on them as necessary.
I have existing word plugin in C# and I'm converting it to Office.js. My requirement is to Add Table in word with 1 row and 1 column. The Cell text would be Content Control of table and text should fit to entire row and also Specify the Row height as mentioned in below Expected results snapshots.
Below is my code in react.
Code in react
Actual Result:(output of the new implementation i.e. Office.js)
Actual Result
Expected Result:(Existing Plugin result i.e. C#)
Exptected Result
Please guide/provide me sample code to achieve this in Office.js
Try using TableRow.preferredHeight to set the height and set TableCell.horizontalAlighnment to Justified to get the contents to fill the cell.
I have a velocity template which has a nested table. I want to align the content of last cell
which has a table inside it to the bottom of the page. I am writing the xml in velocity template and processing the pdf using IText.
I'm not sure I've understood your question, but there is the method setExtendLastRow on PdfPTable object that make the last row on the table high as long as needed to fill the current page, until bottom margin. Example:
PdfPTable tabella = new PdfPTable(4);
PdfPCell cell = new PdfPCell(new Phrase("some text here"));
tabella.addCell(cell);
tabella.addCell(cell);
tabella.addCell(cell);
tabella.addCell(cell);
tabella.setExtendLastRow(true);
the table has only 4 cells that extends to the bottom of the page.
i have a problem that i have two lables,
1) will contain a long text
2) this will be just More button (link)
so i want that when the first text ends then the second label starts right from where it end. but the problem is that the text is variable so i could not find any way to make it dynamic.
example
text of first row
"this is text of first label" "more"
text of second line
"test best" "more"
in the example the rows are of table view and two lables are separated by " so i want second label starting point from where the text in first lable ends
looking forward for some solution
Thanks & Regards!
NSString has some methods to calculate its size when displaying using given font (e.g. sizeWithFont: method) - you can use it to determine text width and place your more button accordingly (someZZZZ parameters must be available on runtime):
CGFloat firstLabelWidth = [firstLabel.text sizeWithFont:firstLabel.font].width;
CGFloat moreX = firstLabel.frame.origin.x + firstLabelWidth + someGap;
moreButton.frame = CGRectMake(moreX, moreY, someWidth, someHeight);
You may need to add some validation for cases when text in first label is too long to fit the screen etc, but in general this code should work.