Can we go to a certain Hole (specified by name) in Matlab Report Generator ?

4 ビュー (過去 30 日間)
RITAM BASU
RITAM BASU 2022 年 6 月 4 日
コメント済み: RITAM BASU 2022 年 6 月 30 日
I have made a word template and tryiing to fill it with the MATLAB report generator. I used DOM API and using the moveToNextHole function.
But, it is accessing some holes multiple times(which are within a text box) and not accessing some. Also, the order of the Holes changes sometimes when I edit the template.
I named all the Holes Individully, and wanted to access the Holes by name.
Is there any standard function or any other way to do that?
Thanks in advance!

採用された回答

Rahin Vadsariya
Rahin Vadsariya 2022 年 6 月 30 日
Hello,
I understand that you want to access the hole by its name.
Follow the below steps to fill the hole by its name:-
a) Use the "customizeReport" function to create a new subclass of the "Report" superclass.
b) Give it properties matching the "Titles" of the holes in the template
c) Create an instance of the subclass, and assign to the properties the values you want to fill the holes with.
d) Use the "fill" function from the Report API to fill the holes automatically.
For example, if you have a hole in the template called "Name", you can create a subclass called "myReport" with the property "Name". Then, use the following code to fill the hole with a name:
rpt = myReport('outputFilename', 'docx', 'myTemplate')
rpt.Name = "John Smith"
fill(rpt)
Hope the above explanation helps.
  1 件のコメント
RITAM BASU
RITAM BASU 2022 年 6 月 30 日
Heyy.. Thanks a lot for your reply.
To be frank, I don't have much knowledge in OOP. So this might be a rookie question -
Can you please share how to create the sublclass called "myReport" using "customizeReport" function?
I tried
myReport = mlreportgen.report.Report.customizeReport(pwd);
But, returns a string and does not work.
Have a nice day.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWaveform Generation についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by