Main Content

組み込み Web ビュー レポートの目次の生成

組み込み Web ビュー レポート ジェネレーターの slreportgen.webview.EmbeddedWebViewDocument 基底クラスは、生成される組み込み Web ビュー レポートに JavaScript® を組み込みます。JavaScript は、レポートの他の部分を生成するだけでなく、ドキュメントの節見出しから目次を生成します。レポートを Web ブラウザーで開くと、ハイパーリンク付きの目次が表示されます。

この機能を使用するには、レポート ジェネレーターの fillContent メソッドでレポート API の Chapter オブジェクトまたは Section オブジェクトを使用するか、DOM API の Heading オブジェクトを使用して、レポートの節と小節を開始する必要があります。次に例を示します。

function fillContent(rpt)

import mlreportgen.dom.*
import mlreportgen.report.*

model = getExportModels(rpt);
model= model{1};
add(rpt, TitlePage("Title", [model " Report"], "Author",""));
finder = slreportgen.finder.ModelVariableFinder(model);

% Create a Variables Chapter
ch = Chapter("Variables");

while hasNext(finder)
    result = next(finder);
    % Create a section for the variable
    s = Section(result.Name);
    
    reporter = getReporter(result);
    add(s, reporter);
    
    % Add this section to the chapter
    add(ch, s);
end

% Add the chapter to the report
add(rpt, ch);
end

組み込み Web ビュー ジェネレーターを作成する他のタスクについては、以下を参照してください。

組み込み Web ビュー レポートを生成するには、組み込み Web ビュー レポートの生成を参照してください。