PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

How to get real row Height?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3729
Page 1 of 1

Author:  pistoletov [ Thu Feb 08, 2018 10:37 am ]
Post subject:  How to get real row Height?

Hi !
I have some rows with this parameters:
data_row[index].HeightRule = RowHeightRule.AtLeast;
data_row[index].Height = "15 pt";

big texts take more than 15 pt of row heigh.
If i try data_row[index].Height.ToString() this returns me 15 pt, but how i can get real row height?

Attachments:
tbl.jpg
tbl.jpg [ 91.15 KiB | Viewed 16908 times ]

Author:  Thomas Hoevel [ Thu Feb 08, 2018 11:20 am ]
Post subject:  Re: How to get real row Height?

Hi!

You can get the real height from the Renderer after calling PrepareDocument.

Basically there is no real height in MigraDoc, the height is calculated when preparing to create a PDF. The height is not calculated when creating RTF.

Author:  pistoletov [ Thu Feb 08, 2018 11:45 am ]
Post subject:  Re: How to get real row Height?

Hm...but i need this where i prepare document.
if my table more than one page i need to make another page with new section.
may be i can get number of text lines in cell's paragraph and calculate height depending on symbols in paragrah.

Author:  Thomas Hoevel [ Thu Feb 08, 2018 11:52 am ]
Post subject:  Re: How to get real row Height?

pistoletov wrote:
if my table more than one page i need to make another page with new section.
If a MigraDoc table does not fit a single page then it will automatically continue on the next page, but in the same section.

Why do you need a new section?

So maybe create one table at first and prepare the document. If the table needs two pages or more, then create a new document and add the new section/new table manually based on the row dimensions calculated for the first document.

Author:  pistoletov [ Thu Feb 08, 2018 12:14 pm ]
Post subject:  Re: How to get real row Height?

table break is not good. Does any settings to correct this situation?
But table does not go to next page - page 1 of 1..

Attachments:
tbl2.jpg
tbl2.jpg [ 55.16 KiB | Viewed 16902 times ]

Author:  Thomas Hoevel [ Thu Feb 08, 2018 12:21 pm ]
Post subject:  Re: How to get real row Height?

pistoletov wrote:
table break is not good.
Then I assume there is something wrong in your code. Maybe you mark all rows as header rows or use KeepWithNext incorrectly.
Tables break to the next page by default - unless you do something wrong.

Are you using class "PdfDocumentRenderer" and method "RenderDocument"?

Author:  pistoletov [ Thu Feb 08, 2018 12:26 pm ]
Post subject:  Re: How to get real row Height?

i use migradoc ddl
...
this.pagePreview = new MigraDoc.Rendering.Forms.DocumentPreview();
......


Document document = gy3.createGy3(new DaoGy3());

// HACK
string ddl = MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToString(document);
this.pagePreview.Ddl = ddl;

Author:  Thomas Hoevel [ Thu Feb 08, 2018 1:43 pm ]
Post subject:  Re: How to get real row Height?

Nothing wrong with the code you are showing here.
Something goes wrong when you add the table to the document. And you don't show that code (not even as an MDDDL file).

Author:  pistoletov [ Thu Feb 08, 2018 1:50 pm ]
Post subject:  Re: How to get real row Height?

here is pastebin code:
https://pastebin.com/fy6HB4cm

from 79 line making header of table
in 141 line add cells with data drom DataTable

And one more question - does it possible to show in document preview all pages and scroll it up-down using mouse wheel?
Now i see only one page and change pages using this.pagePreview.NextPage(); and srolling page using vertical scroll bar

Author:  Thomas Hoevel [ Thu Feb 08, 2018 2:02 pm ]
Post subject:  Re: How to get real row Height?

pistoletov wrote:
And one more question - does it possible to show in document preview all pages and scroll it up-down using mouse wheel?
Yes - if the mouse cursor is not over any text.

You show just a code snippet - nothing's obviously wrong with the code showing.
If you think there is a bug with MigraDoc, please provide a solution:
http://www.pdfsharp.net/wiki/IssueSubmissions.ashx

Author:  pistoletov [ Thu Feb 08, 2018 2:21 pm ]
Post subject:  Re: How to get real row Height?

thank you, Thomas.
I can submit my full project. It based on the DocumentViewer project from examples.
Where i can send this project?
Artem

Author:  Thomas Hoevel [ Thu Feb 08, 2018 2:34 pm ]
Post subject:  Re: How to get real row Height?

pistoletov wrote:
I can submit my full project.
MCVE stand for a Minimal, Complete, and Verifiable Example.
I don't need a "full project" that does not run without a database or such.

If it is smaller than 250 kiB (and it should be - at least after deleting the NuGet packages) you can attach it to a post on the forum.

Weekend starts in 30 minutes. I'll be back at work on Tuesday.

Author:  pistoletov [ Thu Feb 08, 2018 2:53 pm ]
Post subject:  Re: How to get real row Height?

No need db connection.
I make a dao class from dummy data for test purpose.
The project is tiny.
Have a nice weekends!

Attachments:
DocumentViewer.rar [29.39 KiB]
Downloaded 405 times

Author:  Thomas Hoevel [ Thu Feb 08, 2018 3:02 pm ]
Post subject:  Re: How to get real row Height?

I get an error message:
---------------------------
WinZip
---------------------------
Error: "[...]\DocumentViewer.rar" is not a valid RAR file.
---------------------------
OK Help
---------------------------

I prefer ZIP files.
I will try again on Tuesday.

Author:  pistoletov [ Fri Feb 09, 2018 10:57 am ]
Post subject:  Re: How to get real row Height?

ok!
i recompress in zip

Attachments:
DocumentViewer.zip [30.33 KiB]
Downloaded 416 times

Author:  pistoletov [ Thu Feb 15, 2018 9:58 am ]
Post subject:  Re: How to get real row Height?

Hi, Thomas!
Does the new archive ok for test table bug?

Author:  Thomas Hoevel [ Thu Feb 15, 2018 4:41 pm ]
Post subject:  Re: How to get real row Height?

pistoletov wrote:
Does the new archive ok for test table bug?
Extracting works, thanks for that. The linked files for HelloMigraDoc are missing, so it does not compile.
Sorry, but I have to give up for today. Have to do some tasks I get paid for.

Author:  pistoletov [ Sat Feb 17, 2018 11:55 am ]
Post subject:  Re: How to get real row Height?

Hi Thomas. You can remove HelloMigradoc files.
Bugs occures in DocumentViewer project.
Here 2 classes: DAOgy3 (generate some data for document) and gy3 (migradoc preparing document ).

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/