Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[error] <pre>content</pre> #476

Open
Jacyking opened this issue Dec 26, 2024 · 12 comments
Open

[error] <pre>content</pre> #476

Jacyking opened this issue Dec 26, 2024 · 12 comments

Comments

@Jacyking
Copy link

image

@Jacyking
Copy link
Author

Jacyking commented Dec 26, 2024

image
maybe it can not auto start new page ?

@fralx
Copy link
Owner

fralx commented Dec 27, 2024

Hi! If I'm being honest, I don't fully understand what the problem is.
If you want the component to be split into parts and moved to another page, the DataBand it needs to be splitable.
startNewPage starts rendering the band from a new page.
startFromNewPage breaks the DataBand and ReportHeader, without setting this flag, the ReportHeader will be on the same page.

@Jacyking
Copy link
Author

Jacyking commented Dec 30, 2024

image
maybe rect calculation error?
QString(R"(<td style='padding-right: 50px; padding-bottom: 10px; white-space: pre;'>%1</td>)").arg(text)
the databand should not be on the page footer

@Jacyking Jacyking reopened this Dec 30, 2024
@Jacyking
Copy link
Author

Jacyking commented Feb 8, 2025

Hi! If I'm being honest, I don't fully understand what the problem is. If you want the component to be split into parts and moved to another page, the DataBand it needs to be splitable. startNewPage starts rendering the band from a new page. startFromNewPage breaks the DataBand and ReportHeader, without setting this flag, the ReportHeader will be on the same page.

the databand should not be on the page footer

@fralx
Copy link
Owner

fralx commented Feb 8, 2025

Hi! Could You send me an example ( report template with data ) ?

@Jacyking
Copy link
Author

Jacyking commented Feb 10, 2025

run with limereport:
Image

1.zip
auto report = std::make_unique<LimeReport::ReportEngine>(); report->loadFromFile(":/template/1.lrxml"); auto ds = report->dataManager()->createCallbackDatasource("datas"); connect(ds, &LimeReport::ICallbackDatasource::getCallbackData, [](LimeReport::CallbackInfo info, QVariant& value) { switch (info.dataType) { case LimeReport::CallbackInfo::RowCount: value = 5; break; case LimeReport::CallbackInfo::ColumnData: if (info.index == 0) { value = R"(<table border='1'><tr><th>Date and Time</th><th>Time(h)</th><th>User</th><th>Group</th><th>Action and Reason</th></tr>)"; } else { value = R"(<tr><td>2024-12-16 19:20:18</td><td>0.0000</td><td>ABC</td><td>DEF</td><td>text</td></tr>)"; if (info.index == 4) { value = value.toString() + "</table>"; } } break; case LimeReport::CallbackInfo::ColumnCount: value = 1; break; case LimeReport::CallbackInfo::ColumnHeaderData: value = "data"; break; default: break; } }); report->dataManager()->setReportVariable("Batch", "batch"); report->dataManager()->setReportVariable("Title", "title"); report->dataManager()->setReportVariable("Report_By", "report_by"); report->dataManager()->setReportVariable("Report_Time", "report_time"); report->dataManager()->setReportVariable( "Items", QStringList({"<div>a: 1</div>", "<div>b: 2</div>"}).join("\n")); report->dataManager()->setReportVariable( "Company", QString(R"(<a href='%1' style='color: inherit; text-decoration: none;'>%2</a>)") .arg("https://github.com/fralx/LimeReport") .arg("LimeReport")); report->previewReport();

@Jacyking
Copy link
Author

Jacyking commented Feb 10, 2025

run with limereport:
Image

1.zip
auto report = std::make_unique<LimeReport::ReportEngine>(); report->loadFromFile(":/template/1.lrxml"); auto ds = report->dataManager()->createCallbackDatasource("datas"); connect(ds, &LimeReport::ICallbackDatasource::getCallbackData, [](LimeReport::CallbackInfo info, QVariant& value) { switch (info.dataType) { case LimeReport::CallbackInfo::RowCount: value = 5; break; case LimeReport::CallbackInfo::ColumnData: if (info.index == 0) { value = R"(<table border='1'><tr><th>Date and Time</th><th>Time(h)</th><th>User</th><th>Group</th><th>Action and Reason</th></tr>)"; } else { value = R"(<tr><td>2024-12-16 19:20:18</td><td>0.0000</td><td>ABC</td><td>DEF</td><td>text</td></tr>)"; if (info.index == 4) { value = value.toString() + "</table>"; } } break; case LimeReport::CallbackInfo::ColumnCount: value = 1; break; case LimeReport::CallbackInfo::ColumnHeaderData: value = "data"; break; default: break; } }); report->dataManager()->setReportVariable("Batch", "batch"); report->dataManager()->setReportVariable("Title", "title"); report->dataManager()->setReportVariable("Report_By", "report_by"); report->dataManager()->setReportVariable("Report_Time", "report_time"); report->dataManager()->setReportVariable( "Items", QStringList({"<div>a: 1</div>", "<div>b: 2</div>"}).join("\n")); report->dataManager()->setReportVariable( "Company", QString(R"(<a href='%1' style='color: inherit; text-decoration: none;'>%2</a>)") .arg("https://github.com/fralx/LimeReport") .arg("LimeReport")); report->previewReport();

run with web:
Image

@Jacyking
Copy link
Author

Jacyking commented Feb 11, 2025

Hi! Could You send me an example ( report template with data ) ?

I encountered a new (above) problem when I tried to reproduce the bug
(maybe i didn't use datasources before)

@Jacyking
Copy link
Author

Jacyking commented Feb 11, 2025

run with limereport:
Image
1.zip
auto report = std::make_unique<LimeReport::ReportEngine>(); report->loadFromFile(":/template/1.lrxml"); auto ds = report->dataManager()->createCallbackDatasource("datas"); connect(ds, &LimeReport::ICallbackDatasource::getCallbackData, [](LimeReport::CallbackInfo info, QVariant& value) { switch (info.dataType) { case LimeReport::CallbackInfo::RowCount: value = 5; break; case LimeReport::CallbackInfo::ColumnData: if (info.index == 0) { value = R"(<table border='1'><tr><th>Date and Time</th><th>Time(h)</th><th>User</th><th>Group</th><th>Action and Reason</th></tr>)"; } else { value = R"(<tr><td>2024-12-16 19:20:18</td><td>0.0000</td><td>ABC</td><td>DEF</td><td>text</td></tr>)"; if (info.index == 4) { value = value.toString() + "</table>"; } } break; case LimeReport::CallbackInfo::ColumnCount: value = 1; break; case LimeReport::CallbackInfo::ColumnHeaderData: value = "data"; break; default: break; } }); report->dataManager()->setReportVariable("Batch", "batch"); report->dataManager()->setReportVariable("Title", "title"); report->dataManager()->setReportVariable("Report_By", "report_by"); report->dataManager()->setReportVariable("Report_Time", "report_time"); report->dataManager()->setReportVariable( "Items", QStringList({"<div>a: 1</div>", "<div>b: 2</div>"}).join("\n")); report->dataManager()->setReportVariable( "Company", QString(R"(<a href='%1' style='color: inherit; text-decoration: none;'>%2</a>)") .arg("https://github.com/fralx/LimeReport") .arg("LimeReport")); report->previewReport();

run with web:
Image

run with limereport:
Image

reproduce the bug when the row count is 1.
Image

@Jacyking
Copy link
Author

so if i don't know the column count, i should how to do ?

@fralx
Copy link
Owner

fralx commented Feb 20, 2025

It seems that you have a misunderstanding about how LimeReport generates reports.
A report consists of individual independent elements within which you can use HTML to format the text of that specific element.

@fralx
Copy link
Owner

fralx commented Feb 20, 2025

so if i don't know the column count, i should how to do ?

At the moment there is no easy way to solve that issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants