Custom HeaderBand per client
- rafaelwithoeft
- Posts: 70
- Joined: Thu Mar 05, 2015 8:26 pm
Custom HeaderBand per client
Hello, i would to show my situation:
I have multiple clients accessing the same software in same time (web).
Each client has an option to personalize your HeaderBand (header) .
But the files are the same for all customers.
It would be impractical to have a file for each client.Up cuz, we would spend the same problem it can edit the header.
What already tried:
1 - Header in html (text with option enable Html Tags).
Not worked, not accept complex html.
http://forum.stimulsoft.com/viewtopic.php?f=19&t=40192
2 - Capture XML, save the xml of respective component and replace on render all reports.
It generates error, I believe that the references to other components.
I would like some idea of you who understand the functioning of the tool, which I could do in that situation? If something was not clear, please advise so I try to improve the explanation ...
Best Regards
I have multiple clients accessing the same software in same time (web).
Each client has an option to personalize your HeaderBand (header) .
But the files are the same for all customers.
It would be impractical to have a file for each client.Up cuz, we would spend the same problem it can edit the header.
What already tried:
1 - Header in html (text with option enable Html Tags).
Not worked, not accept complex html.
http://forum.stimulsoft.com/viewtopic.php?f=19&t=40192
2 - Capture XML, save the xml of respective component and replace on render all reports.
It generates error, I believe that the references to other components.
I would like some idea of you who understand the functioning of the tool, which I could do in that situation? If something was not clear, please advise so I try to improve the explanation ...
Best Regards
Re: Custom HeaderBand per client
Hello.
Maybe Master Report will solve your issue.
You can create a report template with header for each customer.
Then before rendering set this report template as Master Report with next code:
Thank you.
Maybe Master Report will solve your issue.
You can create a report template with header for each customer.
Then before rendering set this report template as Master Report with next code:
Code: Select all
report.MasterReport = masterReport.SaveToString();
- rafaelwithoeft
- Posts: 70
- Joined: Thu Mar 05, 2015 8:26 pm
Re: Custom HeaderBand per client
You have a sample do how to implement this?
I have looked my code and StiReport (com.stimulsoft.report.StiReport;) do not have this properties.
I use HTML Designer and Html Viewer version / latest release.
This solution (Master Report) work with custom footer? And header + footer too?
How could I implement this solution with two separate templates, but they need to work together? Customers like to edit this separately, but render on template together (Header and Footer)
I have saved the master template on database (header and footer) and deserialize it on render... like:
How do it?
Thank you.
I have looked my code and StiReport (com.stimulsoft.report.StiReport;) do not have this properties.
I use HTML Designer and Html Viewer version / latest release.
This solution (Master Report) work with custom footer? And header + footer too?
How could I implement this solution with two separate templates, but they need to work together? Customers like to edit this separately, but render on template together (Header and Footer)
I have saved the master template on database (header and footer) and deserialize it on render... like:
Code: Select all
//....Coode
//Header
InputStream stream = new ByteArrayInputStream(configuracao.getValor().getBytes(StandardCharsets.UTF_8));
StiReport masterHeader = StiSerializeManager.deserializeReport(stream);
//....Code
//Footer
InputStream stream = new ByteArrayInputStream(configuracao.getValor().getBytes(StandardCharsets.UTF_8));
StiReport masterFooter = StiSerializeManager.deserializeReport(stream);
//....Code
Code: Select all
mainReport.MasterReport = masterHeader + masterFooter ?
Re: Custom HeaderBand per client
Hello.
If I understand right: you want to have one template for all customers, but each customer want to customize his own header?
Customer can edit only his header?
If I understand right: you want to have one template for all customers, but each customer want to customize his own header?
Customer can edit only his header?
- rafaelwithoeft
- Posts: 70
- Joined: Thu Mar 05, 2015 8:26 pm
Re: Custom HeaderBand per client
Yes, it really is quite complex.
We have a amount of reports for multiple clients (actually many and many client).
All reports are possible to get custom header and footer. (They need to edit header and/or footer in one local, and get results in all reports, we thought create a template to header and another to footer and load it on all reports on before render...)
Process (quick explanation) :
1 - Client go to edit header or footer on web designer (special template only for header and another for footer).
2 - Client Save it. (I get xml and save on client database).
3 - On before render all reports, i get xml and deserialize it to StiReport.
Now...
I need to add it to a main report (main report + custom header + custom footer).
If you really need me to demonstrate some other more detail, please let me know
Thank you
We have a amount of reports for multiple clients (actually many and many client).
All reports are possible to get custom header and footer. (They need to edit header and/or footer in one local, and get results in all reports, we thought create a template to header and another to footer and load it on all reports on before render...)
Process (quick explanation) :
1 - Client go to edit header or footer on web designer (special template only for header and another for footer).
2 - Client Save it. (I get xml and save on client database).
3 - On before render all reports, i get xml and deserialize it to StiReport.
Now...
I need to add it to a main report (main report + custom header + custom footer).
If you really need me to demonstrate some other more detail, please let me know
Thank you
Re: Custom HeaderBand per client
Hello.
Here is example of copy HeaderBand:
Here is example of copy HeaderBand:
Code: Select all
StiHeaderBand band = (StiHeaderBand) report.getComponents().get("HeaderBand");//get by name
String st = StiSerializerControler.serializedObjectAsString(band);
StiHeaderBand newBand = new StiHeaderBand();
StiDeserializerControler.deserializeFromString(st, newBand);
newBand.setPage(newReport.getPages().get(0));
newReport.getPages().get(0).getComponents().add(newBand);
- rafaelwithoeft
- Posts: 70
- Joined: Thu Mar 05, 2015 8:26 pm
Re: Custom HeaderBand per client
Thanks, but the replace not worked :/
Application not give more errors/exceptions (if i use the properties "setPage()/getPages() application got exceptions.")... but the main component is not deleted...
PS: Header is printed on all pages.
Please, look my code:
Application not give more errors/exceptions (if i use the properties "setPage()/getPages() application got exceptions.")... but the main component is not deleted...
PS: Header is printed on all pages.
Please, look my code:
Code: Select all
//Code...
InputStream stream = new ByteArrayInputStream(xmlString.getBytes(StandardCharsets.UTF_8));
report = StiSerializeManager.deserializeReport(stream);
//Code.....
StiPageHeaderBand headerBand = (StiPageHeaderBand) report.getComponents().get("b_cabecalho");
if (headerBand != null)
{
report.getComponents().remove(headerBand);
StiPageHeaderBand newBand = new StiPageHeaderBand();
StiDeserializerControler.deserializeFromString(configuracao.getValor(), newBand);
report.getComponents().add(newBand);
}
Re: Custom HeaderBand per client
Hello,
Can you please send us the simple test project with data, which reproduce the issue, for analysis?
Thank you.
Can you please send us the simple test project with data, which reproduce the issue, for analysis?
Thank you.
- rafaelwithoeft
- Posts: 70
- Joined: Thu Mar 05, 2015 8:26 pm
Re: Custom HeaderBand per client
Yes, please wait i create it.
-------EDIT--------
Hello, i created a sample project on eclipse (simplified compared to original, but operation is identical and have the same problem related previously).
The xml files represent the database strings with xml content of report's.
xml.xml -> Default report xml.
xmlcustom.xml -> Xml of component PageHeader ("b_cabecalho") edited by the client.
Differences:
xml.xml has an image.
xmlcustom.xml not get the picture.
The custom xml was achieved as follows:
Note: In the original design only the component "b_cabecalho" is retrieved, if the customer insert anything different or out of it, which is outside is ignored. Then work with the issue of saving and only replace the component "b_cabecalho" in this case. (The same goes for the footer, but solving the header automatically the rest will fall into place ...)
Thank you.
-------EDIT--------
Hello, i created a sample project on eclipse (simplified compared to original, but operation is identical and have the same problem related previously).
The xml files represent the database strings with xml content of report's.
xml.xml -> Default report xml.
xmlcustom.xml -> Xml of component PageHeader ("b_cabecalho") edited by the client.
Differences:
xml.xml has an image.
xmlcustom.xml not get the picture.
The custom xml was achieved as follows:
Code: Select all
StiPageHeaderBand band = (StiPageHeaderBand) report.getComponents().get("b_cabecalho");//recuperamos pelo nome - padronizado
String st = StiSerializerControler.serializedObjectAsString(band);
Thank you.
- Attachments
-
- webdesigner_test.rar
- Eclipse Sample Project
- (15.28 MiB) Downloaded 529 times
Re: Custom HeaderBand per client
Hello.
report.getComponents() return new list af all components.
So you must remove component like in previous example:
Also if you want to use customBand you must create new report & header band in it. (not like in your example xmlcustom.xml)
report.getComponents() return new list af all components.
So you must remove component like in previous example:
Code: Select all
headerBand.getPage().getComponents().remove(headerBand);