ITextSharp auto fit table column width to maximum - itext

I have face several problems when using ITextSharp table.
1) How to auto fit table column width to maximum?
2) How to push the entire table to the right (right-align table not right-align table content)
below are what i am trying to achieve where | indicates starts and end of page.
As we can see, column 1 (invoice A, B, CDE) are of different width, same to column 3. I would like itextsharp to auto fit the width. Perhaps there is a function in itextsharp that can achieve this?
| Invoice A : Be |
| B : Cdefg |
| CDE : abc |

Regarding part 1 of your question: auto-sizing of columns based on their content
Please take a look at The Best iText Questions on StackOverflow. It has different examples on how to tune tables, especially in the chapter named "Tables".
It is important to understand that PDF is a format where you decide what content goes where. In other words: you define the width of the columns. The width of the columns is not defined by their content as is the case in HTML.
If you want the tables to "auto-size", why don't you create your tables as HTML and then use XML worker to convert the HTML to PDF. In that case, iText's XML Worker will look at the content and adjust the column width accordingly. For an example, take a look at my answer to the following question: How to get particular html table contents to write it in pdf using itext
Incidentally, that example is written in Java, but if you need a C# example, you'll find a C# example here: itextsharp html to pdf
Regarding part 2 of your question: setting the alignment of a table
There is a method for that. In Java, it's setHorizontalAlignment(). You can find the C# counter-part here: Align itextsharp table
In other words, you need:
table.HorizontalAlignment = Element.ALIGN_RIGHT;

Related

Split text into Columns with Flutter Pdf

I'm using the pdf/pdf.dart package to create a PDF document that displays long paragraphs of text in an article-like format. I'm running into an issue where I cannot figure out how to format the pdf in a way where text spans across multiple columns.
I have an input as a big String of text, and I need it to be formatted into two columns to span across multiple pages. I have only been able to span the text in 1 column across multiple pages (using the column and richtext pdf widgets).
To clarify here is an example of the format I have been able to achieve (notice the text is in a single column): https://www.ohchr.org/sites/default/files/UDHR/Documents/UDHR_Translations/eng.pdf
Here is what I am hoping to achieve (notice the text spans across multiple columns on the same page): https://constitutioncenter.org/media/files/constitution.pdf
Is this possible with the package I am using, if not are there any packages anyone knows of that can achieve this?

Border not display on next row for split-column-data

I have a model xml data:
Model data
I have been using split-column-data: to display column dynamically as I have some data with multiple different column. The thing is the border between each rows is missing. <?split-column-data:Test?> <?TestValue?> This is how i display the Test column dynamically. below are my RTF template from word
RTF template in words
I keep getting this:
Row border is missing
And the ideal out would be: ideal output with row border missing
Sorry for my bad english, but I need help please. Thanks
If you have already tried all the standard boarder stuff in Word, you can insert a nested table for each field (table within a table). Change the parent cell to have 0 margins/padding. Keep the for-each/end-for-each in the parent table.

How can I use Footnotes with Oracle BI Publisher

I am putting a footnote in an .rtf template, and before generating a report it seems ok,
but when I load an XML sample and preview the document (.pdf or .doc etc.)
the footnote content goes right into the body of my report (example is in the picture).
I've tried using text boxes, but it doesn't help.
I've also tried just making a paragraph look as a footnote, but since I have a lot of
tags in my template, the footnote-looking text doesn't stay at the
bottom of the page.
and I can't use footers/headers because I need only one footnote at one page.
Try to draw a borderless table with one column and two rows where the first row has fixed hight (exactly) of the size of body, and the second row fixed hight of the size you want to reserve for the footer. Then you place your xml data in those two rows of the table the same way as you put it on the page. I use that for different forms when the position of the data is fixed. There are also other table/row/column properties that you might want to use.

Rmd to word with flex table - need to increase margins of ONLY the table in the word output

I am building a routine report in Rmd that is outputted to word.
I have created a reference document to determine all the fonts and styles.
I am using flextable to create the table in this report.
The table needs to be wider than the margins of the rest of the word document.
Is there anyway to do this?
So far I am only getting the correct margins on the outputted table by increasing the margins in the reference document, but this isn't a great solution since the rest of the document, which is mostly text, needs to stay within certain margins.
I have tried increasing the width of the columns (width function for flextable), but that also doesn't work.
Any help would be appreciated!

SSRS Double row headers and data display for printing

** I'm using SSRS2008 R2
I have a report that the users would like to see in a printable pdf.
Problem is there are several columns, potentially too many to fit on a printed 8.5x11 paper.
One of the concepts they suggested was a stacked header/data display, like breaking the columns into 2 rows, so 2 rows of data (for John and Bill) would look like this:
NAME START_DATE STATE COMPANY
ACCOUNT BALANCE END_DATE
-------------------------------------------------------
John 1/20/2016 NY GE
10076 $100.00 2/20/2016
-------------------------------------------------------
Bill 5/13/2016 MA Netflix
00013 $150.00 12/31/2016
-------------------------------------------------------
This leads me to 2 questions:
Is there a way to do this with a tablix?
AND/OR in addition, is there a way to set a default property on the report so when the report is exported to pdf and to print, that it defaults to fit all columns on one page (therefor shrinking the font size to fit on page?)
For anyone that cares - Apparently this can easily be achieved by dragging a Tablix onto the work area, right clicking the header row, adding a new row underneath (basically becomes header row 2), then do the same thing to the details row - however make sure to insert row - Inside group. That allows you to have stacked header and data rows and you can copy / paste headers and row values in whichever row you'd prefer.
it will work if you make all the columns on the same height not unequal. If all the columns has same height, then while exporting to pdf/excel and print it will come in the same page.