How to get table height in PDFsharp? - pdfsharp

I'm using PDFsharp to generate PDF documents and these documents (invoices) contain tables.
Is there any way to determine the height of a table? I need to know the height as VAT and Total tables have to be positioned at the bottom of the page. I don't think a count of the rows would do because product descriptions can get wrapped resulting in increased row height for some rows

Not sure if I understand the problem.
I think you want to create a table that spans several pages, but you need a summary at the bottom of each page.
Sounds like you're using MigraDoc, not PDFsharp.
MigraDoc works similar to Word: you define the contents, MigraDoc cares for the pagebreaks.
Tables with sum rows at the bottom are not supported.
You can add sum rows and pagebreaks manually. To do this you must estimate how many items fit on one page (taking the length of descriptions into account).

Related

Circumventing query page size limitations

In the Project Tracker template there is a feature where statistics for a certain project's items are displayed. You can filter the project items, but the statistics will only show those statistics for all the project items, i.e. the filters do not affect the statistics.
I would like to add the feature of filters affecting those statistics in a similar implementation of mine. My current solution passes the keys of those project items (affected by filters, too) to a calculated data source, which then calculates the statistics using those item keys, essentially applying the filters used in the page.
My issue is that my calculations are restricted by the query page size. For example, if I apply filters that limit the number of items to 15 records, but the page size is 10 records, I will only have statistics of those first 10 items, which is not useful. I'd need to have the statistics on all the records that are left after filtering.
One way to solve this would be to get rid of the query page size and leave it at 0. However, similarly to the Project Tracker template, I'm displaying the project items on the page in a table, and if I do that, the page becomes too heavy.
How can I circumvent the query page size? I'm thinking I could
limit the items displayed in the page by some other way than query page size (i.e. hiding items from the UI)
use a different datasource for the statistics, but in some way copying the filters used in the datasource that is displaying the project items
Both of these ways I could think of, I can't seem to implement. I don't know how I could hide items from the UI to make it less heavy, as query page size pretty much does it. I have also tried copying the filters from a datasource to a similar one, but that does not seem to work.
EDIT: I might have come up with a way to solve this myself, but I still need to implement it. Now I'm using the page size restricted Items Ds to apply the filters on, and the statistics are build from this data source. If instead, I use a non-restricted Ds called AllItems, and apply the filters on it, and then pass the item keys to a page size restricted Ds (to show the items in UI) AND to a calculated Ds (for the stats). Will make a response once I've verified it works.
I solved the issue myself.
To produce (refreshable) statistics subject to filtering but not restricted by page size, I used the following datasource structure:
In this structure, the filters practically flow to the data sources below, as they are passed the ItemKeys that fit the filter. What this completes is that my Statistics (used in piegraphs etc.) can be filtered dynamically and account for all the records that fit the filter, while the UI does not get crowded over too many records, as the data source used in UI has a query page size limitation.

Repeat columns in a table

I am new to PDFsharp and MigraDoc. I have a requirement to generate a dynamic report with a header and a table.
The table should have a number of columns that are fixed and repeated on every page. I understand MigraDoc automatically calculates the width of the table and splits it over multiple pages if required.
Can someone please share an example of the repeated columns on multiple pages? I cant seem to find anything on google.
The current implementation of MigraDoc does not support splitting tables horizontally across pages. Repeated columns that are required for horizontally split tables do not currently work automatically.
Tables automatically split vertically (i.e. across several pages) and header rows are automatically repeated.
To simulate horizontal splitting you can create several tables and merge them.
In our application we chose a workaround: we let the page width grow as needed for the table. This works fine for tables that are to be viewed on the screen, but does not work well for tables that have to be printed.

Display product images in a datagrid in 4 columns and X rows (VB.NET)

Hello I am building a POS system and would like to display a list of images all available products for selection.
So for example, if someone picks category: Shirts, a datagrid of images all Shirts in that category should appear.
The grid should show in a 4 by X matrix where X is the number of columns (dependant on the number of products obviously).
So the result should look something like this link (with only the pictures showing and no writing to keep it simple).
Any Ideas at all please? Not expecting code, just some guidance on how to kick this off.
There are a million different ways to accomplish this.
Repeater controls will simply repeat for every result you pass them, and could pretty easily be set to repeat horizontally, and provide a line break every four records. Them you would just need to repeat an image who's source was databound you each image for your products.
That's probably the simplest approach, but you could get all kinds of fancy with client side ui elements, paging, sorting, etc. Just depends on what you need and how long you have to work on this one piece.

How to create an RDLC report when total number of columns are unknown?

One of the reports I am creating has dynamic number of columns - a datatable gets returned from the stored procedure, the number of columns depend on the number of items defined in the database (one column for each item, other than some fixed columns).
Is it possible for me to use RDLC report to generate a report in this case? All the calculations are already done int he report, I am looking at RDLC only for the sake of export to excel/pdf and repeating header/footer.
It is possible, but there is no simple solution. Here is a link to a former answer of mine on this topic.
An additional investigation later
Here is an article describing the mentioned report generation with a self generated RDL object model in detail.
From the sounds of it, you want your report to pivot defined items, which can change with respect to various report criteria. If you know all the columns that COULD come back, you could just define your RDL to bind them all but hide the ones that aren't item defined. You would just have to bind the Visible property of the column to a determination of whether the has been defined.
For your Problem,
I guess you can go for matrix instead of tables.
where you can generate rows and columns dynamically according to the data you are getting.
Check here for using of matrix
Use matrix in RDLC whenever your columns are not fixed in datatable.
Visit http://www.gotreportviewer.com/matrices/
Here you'll find use of both table and matrix in RDLC. See yourself which one suits for your requirement.

How to link table row heights from two tables in SQL reporting services

I have two tables in a SQL Reporting Services report (table + matrix) that I would like to display side by side to give the illusion of one complete table.
The problem is that there may be more data in the row of one table vs the other and therefore the rows could be different heights.
Is there any way to match/link the heights of the rows in both tables.
Ok so after an exhaushtive search I dont think there is an answer to this one.
My proposed work round for this is to export straight to Excel which is what my users will do anyway. Excel lines up all the rows correctly. The only thing to be aware of here is the join between the table and the matrix as sometimes excel will merge two columns together if they overlap.

Resources