Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
e984782
Added a settings section for format templates
Sabrina-devops Oct 26, 2026
968401d
Added format templates to configuration plugins, with export and import
Sabrina-devops Oct 26, 2026
fdfb96c
Shared the file handling of Office templates
Sabrina-devops Oct 27, 2026
029ac6a
Shared the format template management between settings and a dialog
Sabrina-devops Oct 27, 2026
690054f
Added PowerPoint templates to the format template list
Sabrina-devops Oct 27, 2026
b2040b5
Added a writer for Word templates
Sabrina-devops Oct 27, 2026
b0eabf2
Added lists, tables, and code to the Word template writer
Sabrina-devops Oct 27, 2026
ee3d0ef
Added format templates to the Word export
Sabrina-devops Oct 27, 2026
4bd6be5
Documented format templates
Sabrina-devops Oct 27, 2026
6ebaae8
Add I18N
Sabrina-devops Oct 27, 2026
23fd5bd
Reviewed the German texts of format templates
Sabrina-devops Oct 27, 2026
1155677
Kept the headers and footers of Word templates with several sections
Sabrina-devops Nov 2, 2026
21d290a
Matched the headings of answers to Word templates
Sabrina-devops Nov 2, 2026
31373ab
Used the list numbering of Word templates
Sabrina-devops Nov 2, 2026
3376507
Spaced the paragraphs of answers like the Word template
Sabrina-devops Nov 2, 2026
fec873e
Kept the indentation of list styles in Word templates
Sabrina-devops Nov 3, 2026
6f5f891
Started the text of the first page where the Word template does
Sabrina-devops Nov 3, 2026
c013aee
Kept the page layout of the first page of Word templates
Sabrina-devops Nov 3, 2026
18682a7
Kept the boxes and pictures around the text of Word templates
Sabrina-devops Nov 3, 2026
8cf6279
Filled the title box of Word templates with the title of the answer
Sabrina-devops Nov 3, 2026
daaa30a
Kept the cover pages and the main section of Word templates
Sabrina-devops Nov 4, 2026
8b6033f
Took the margins of the chapters of Word templates for the answer
Sabrina-devops Nov 4, 2026
6fffde1
Documented how exports follow Word templates
Sabrina-devops Nov 4, 2026
ce95337
Merged main into the Word template export
Sabrina-devops Nov 4, 2026
223f7ee
Limited format templates to Word templates for now
Sabrina-devops Nov 4, 2026
39da2d0
Clarified the texts of format templates
Sabrina-devops Nov 4, 2026
5dbccbb
Moved the changelog of Word templates to v26.11.1
Sabrina-devops Nov 4, 2026
7ae3184
Localized the changed texts of format templates
Sabrina-devops Nov 4, 2026
b62f700
Merged main into the Word template export
Sabrina-devops Nov 4, 2026
ed0c1fe
Added PowerPoint templates to the format templates
Sabrina-devops Nov 4, 2026
49133cb
Added a selection of format templates
Sabrina-devops Nov 4, 2026
1164062
Chose the template of the Slide Assistant from the format templates
Sabrina-devops Nov 4, 2026
b409d2a
Preselected the template of the Slide Assistant from the format templ…
Sabrina-devops Nov 4, 2026
7103abc
Documented PowerPoint format templates for the Slide Assistant
Sabrina-devops Nov 4, 2026
46415aa
Showed the type of each format template in their list
Sabrina-devops Nov 4, 2026
2a9325b
Aligned the button of the template selection with its field
Sabrina-devops Nov 4, 2026
3a5cebd
Localized the texts of PowerPoint format templates
Sabrina-devops Nov 4, 2026
d431cc0
Merged main into the Word template export
SommerEngineering Nov 29, 2026
a006bbd
Used the chosen form of address in the texts of format templates
SommerEngineering Nov 29, 2026
2ad6cb2
Shared the helpers of the Word writer
SommerEngineering Nov 29, 2026
049518d
Split the Word writer into classes of one task each
SommerEngineering Nov 29, 2026
78fb63c
Fixed old entries of a table of contents in exports into Word templates
SommerEngineering Nov 29, 2026
6c2940b
Fixed exports into Word templates on systems which write negative num…
SommerEngineering Nov 29, 2026
2357cd5
Fixed an empty page in exports into Word templates whose table of con…
SommerEngineering Nov 29, 2026
02cb2f6
Fixed shapes shown twice in exports into Word templates whose main se…
SommerEngineering Nov 29, 2026
254ecfe
Fixed the numbering of added heading levels in exports into Word temp…
SommerEngineering Nov 29, 2026
9c8b5f4
Fixed lists in exports into Word templates which keep their numbering…
SommerEngineering Nov 29, 2026
2b80a16
Fixed text running into the shapes of footers in content controls in …
SommerEngineering Nov 29, 2026
c67a6e5
Fixed the layout estimate of paragraphs with text boxes in exports in…
SommerEngineering Nov 29, 2026
b06113d
Limited the size of Word templates to the memory of the computer
SommerEngineering Nov 29, 2026
307f997
Fixed format templates whose paths differ only in their spelling
SommerEngineering Nov 29, 2026
1affe2c
Fixed the warning about missing template files after quick changes
SommerEngineering Nov 29, 2026
ecf9f2c
Tested the paths of format templates in configuration plugins
SommerEngineering Nov 29, 2026
8dda6c2
Shared the export menu of document formats
SommerEngineering Nov 29, 2026
bf4425b
Added Word templates to the export of the BeyondFacts Lab
SommerEngineering Nov 29, 2026
1f116a8
Added a Word template for the result files of the Batch Processing As…
SommerEngineering Nov 29, 2026
fd7ca34
Wrote the Word result files of the Batch Processing Assistant into a …
SommerEngineering Nov 29, 2026
a27020d
Limited the size of PowerPoint templates to the memory of the computer
SommerEngineering Nov 29, 2026
3b63b6a
Added format templates to the changelog
SommerEngineering Nov 29, 2026
6c98821
Translated the texts of format templates
SommerEngineering Nov 29, 2026
d5806f6
Reviewed the German texts of format templates
SommerEngineering Nov 29, 2026
501eb60
Listed a missing Word template of the Batch Processing Assistant afte…
SommerEngineering Nov 29, 2026
dc6ecf1
Remove unused dialog options alias
SommerEngineering Nov 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Therefore, before you plan, read, or change anything in one of these areas, read
| anything under `app/MindWork AI Studio/Tools/Services/Indexing/`, or `DataSourceEmbeddingService` | `app/MindWork AI Studio/Tools/Services/Indexing/AGENTS.md` |
| anything under `app/MindWork AI Studio/Tools/Databases/` | `app/MindWork AI Studio/Tools/Databases/AGENTS.md` |
| anything under `app/MindWork AI Studio/Tools/PowerPoint/` or `app/Tests/Tools/PowerPoint/`, or the PowerPoint part of the Slide Assistant | `app/MindWork AI Studio/Tools/PowerPoint/AGENTS.md` |
| anything under `app/MindWork AI Studio/Tools/Word/` or `app/Tests/Tools/Word/`, or the export into a Word template | `app/MindWork AI Studio/Tools/Word/AGENTS.md` |
| anything under `app/MindWork AI Studio/Tools/DocumentSegments/` or `app/Tests/Tools/DocumentSegments/`, or an assistant which works on whole documents | `app/MindWork AI Studio/Tools/DocumentSegments/AGENTS.md` |

This file keeps only what applies to the whole repository. `app/AGENTS.md` keeps what applies to all of the
Expand Down
17 changes: 17 additions & 0 deletions app/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,23 @@ presentation with the Open XML SDK (`DocumentFormat.OpenXml`), in `app/MindWork
**Area guide:** `app/MindWork AI Studio/Tools/PowerPoint/AGENTS.md`, with how a presentation comes about
and the rules which are easy to break.

## Word templates

An answer exported into a Word template is written with the Open XML SDK as well, in
`app/MindWork AI Studio/Tools/Word/`; without a template, Pandoc writes it. Both kinds of Office documents
come about along a `PackageSkeleton` of their template, in a `StagedDocument` which `TargetFile` streams into the
file the user chose, all from `app/MindWork AI Studio/Tools/OpenXml/`.

Word and PowerPoint templates are format templates (`Settings/FormatTemplate.cs`), which users keep in the
app settings: the export menus of documents list the Word templates, the Slide Assistant the PowerPoint
ones. Every export menu which offers the document formats, such as that of a chat answer or of a result of
the BeyondFacts Lab, takes them from `DocumentFormatMenuItems`, so that each one lists the templates. Which templates of a kind a place offers, and how it shows them, comes from `FormatTemplateExtensions`;
a selection of them is `FormatTemplateSelection`. A new kind of template joins `FileTypes.FORMAT_TEMPLATE`
once something uses it.

**Area guide:** `app/MindWork AI Studio/Tools/Word/AGENTS.md`, with how a document comes about and the
rules which are easy to break.

## Document Segments

An assistant which works on a whole document, such as the Translation assistant with "Translate document",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ else

@if (this.outputMode is BatchProcessingOutputMode.INDIVIDUAL_FILES)
{
<MudSelect T="FileExportFormat" @bind-Value="@this.resultFileFormat" Disabled="@this.isProcessingBatch" AdornmentIcon="@AppIcons.DOCUMENT" Adornment="Adornment.Start" Label="@T("File format")" HelperText="@TA("Choose the format of the result files. Everything except Markdown is converted by Pandoc, which AI Studio offers to install when it is missing.")" Variant="Variant.Outlined" Margin="Margin.Dense" Class="mb-3">
<MudSelect T="FileExportFormat" @bind-Value="@this.resultFileFormat" Disabled="@this.isProcessingBatch" AdornmentIcon="@AppIcons.DOCUMENT" Adornment="Adornment.Start" Label="@T("File format")" HelperText="@TA("Choose the format of the result files. Pandoc writes all of them except Markdown, and Word files only without a template. AI Studio offers to install Pandoc when it is missing.")" Variant="Variant.Outlined" Margin="Margin.Dense" Class="mb-3">
@foreach (var format in FileExportFormat.AnswerFormats)
{
<MudSelectItem Value="@format">
Expand All @@ -165,6 +165,11 @@ else
}
</MudSelect>

@if (this.resultFileFormat.FormatTemplateFilter is { } formatTemplateKind)
{
<FormatTemplateSelection @bind-FilePath="@this.resultFormatTemplatePath" Kind="@formatTemplateKind" Label="@T("Template")" Icon="@this.resultFileFormat.Icon" Validation="@this.ValidateResultFormatTemplate" Disabled="@this.isProcessingBatch"/>
}

<MudJustifiedText Typo="Typo.body2" Class="mb-3">
@(string.Format(T("Each answer is stored as its own file. Those files are named after the document, e.g., the answer for report.pdf is stored as report_result{0}."), this.resultFileFormat.FileExtension))
</MudJustifiedText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Globalization;

using AIStudio.Settings;
using AIStudio.Tools.Word;

namespace AIStudio.Assistants.BatchProcessing;

Expand All @@ -16,12 +17,16 @@ private async Task StartBatchProcessingAsync()
var (resolvedOutputDirectory, files) = runPreparation.Value;

//
// Every format but Markdown is written by Pandoc, so it has to be there before the first
// document. Asking per document would put the installation dialog in front of the user
// hundreds of times, and starting without it would spend time and tokens on answers we
// cannot write anywhere:
// Pandoc writes every format but Markdown, and Word only without a template, so it has to be
// there before the first document. Asking per document would put the installation dialog in
// front of the user hundreds of times, and starting without it would spend time and tokens on
// answers we cannot write anywhere. The same goes for a template we cannot write into:
//
if (this.outputMode is BatchProcessingOutputMode.INDIVIDUAL_FILES && this.resultFileFormat.UsesPandoc)
var templatePath = this.ResultFilesTemplatePath;
if (templatePath.Length > 0 && !await this.CanWriteIntoResultFilesTemplateAsync(templatePath))
return;

if (this.outputMode is BatchProcessingOutputMode.INDIVIDUAL_FILES && this.resultFileFormat.UsesPandoc && templatePath.Length == 0)
{
var pandocState = await this.PandocAvailability.EnsureAvailabilityAsync(showSuccessMessage: false, showDialog: true);
if (!pandocState.IsAvailable)
Expand Down Expand Up @@ -270,7 +275,20 @@ private async Task ProcessOneFileAsync(BatchProcessingFileResult fileResult, str
//
var resultText = this.DisclosureService.AddDisclosureToMarkdown(aiAnswer);
var resultFilePath = Path.Join(resolvedOutputDirectory, this.CreateResultFileName(fileResult.FileName));
if (this.resultFileFormat.UsesPandoc)
if (this.ResultFilesTemplatePath is { Length: > 0 } templatePath)
{
//
// Only Word templates serve a format so far, so the Word writer takes every template, as in
// DocumentExport. The top heading level of the answer becomes the first heading level of the
// template, read from the answer alone, without the notice that AI generated it:
//
if (!await WordDocumentFile.CreateAsync(templatePath, resultFilePath, resultText, MarkdownWordConverter.HeadingLevelsOf(aiAnswer), this.Logger, token))
{
this.FinishFileResult(fileResult, BatchProcessingFileStatus.FAILED, T("The template changed while the result file was written into it, e.g., because Word saved it."));
return;
}
}
else if (this.resultFileFormat.UsesPandoc)
{
//
// Pandoc reports a failure instead of throwing, because one document which
Expand All @@ -287,6 +305,11 @@ private async Task ProcessOneFileAsync(BatchProcessingFileResult fileResult, str

this.FinishFileResult(fileResult, BatchProcessingFileStatus.DONE, Path.GetFileName(resultFilePath));
}
catch (OperationCanceledException) when (token.IsCancellationRequested)
{
// Writing into a template stops when the run is canceled:
this.FinishFileResult(fileResult, BatchProcessingFileStatus.CANCELED, T("The batch run was canceled."));
}
catch (Exception e)
{
this.FinishFileResult(fileResult, BatchProcessingFileStatus.FAILED, string.Format(T("Was not able to write the result file: {0}"), e.Message), e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public partial class AssistantBatchProcessing
private static readonly AssistantSessionStateKey<DataDocumentAnalysisPolicy?> SELECTED_POLICY_STATE_KEY = new(nameof(selectedPolicy));
private static readonly AssistantSessionStateKey<BatchProcessingOutputMode> OUTPUT_MODE_STATE_KEY = new(nameof(outputMode));
private static readonly AssistantSessionStateKey<FileExportFormat> RESULT_FILE_FORMAT_STATE_KEY = new(nameof(resultFileFormat));
private static readonly AssistantSessionStateKey<string> RESULT_FORMAT_TEMPLATE_PATH_STATE_KEY = new(nameof(resultFormatTemplatePath));
private static readonly AssistantSessionStateKey<string> RESULT_COLUMN_HEADER_STATE_KEY = new(nameof(resultColumnHeader));
private static readonly AssistantSessionStateKey<string> CSV_FILE_NAME_STATE_KEY = new(nameof(csvFileName));
private static readonly AssistantSessionStateKey<BatchProcessingCsvSeparator> CSV_SEPARATOR_STATE_KEY = new(nameof(csvSeparator));
Expand Down Expand Up @@ -52,6 +53,7 @@ protected override void CaptureCustomAssistantSessionState(AssistantSessionState
state.Set(SELECTED_POLICY_STATE_KEY, this.selectedPolicy);
state.Set(OUTPUT_MODE_STATE_KEY, this.outputMode);
state.Set(RESULT_FILE_FORMAT_STATE_KEY, this.resultFileFormat);
state.Set(RESULT_FORMAT_TEMPLATE_PATH_STATE_KEY, this.resultFormatTemplatePath);
state.Set(RESULT_COLUMN_HEADER_STATE_KEY, this.resultColumnHeader);
state.Set(CSV_FILE_NAME_STATE_KEY, this.csvFileName);
state.Set(CSV_SEPARATOR_STATE_KEY, this.csvSeparator);
Expand Down Expand Up @@ -85,6 +87,7 @@ protected override void RestoreCustomAssistantSessionState(AssistantSessionState
state.Restore(SELECTED_POLICY_STATE_KEY, value => this.selectedPolicy = value);
state.Restore(OUTPUT_MODE_STATE_KEY, value => this.outputMode = value);
state.Restore(RESULT_FILE_FORMAT_STATE_KEY, value => this.resultFileFormat = value);
state.Restore(RESULT_FORMAT_TEMPLATE_PATH_STATE_KEY, value => this.resultFormatTemplatePath = value);
state.Restore(RESULT_COLUMN_HEADER_STATE_KEY, value => this.resultColumnHeader = value);
state.Restore(CSV_FILE_NAME_STATE_KEY, value => this.csvFileName = value);
state.Restore(CSV_SEPARATOR_STATE_KEY, value => this.csvSeparator = value);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
using AIStudio.Settings;
using AIStudio.Tools.DocumentSegments;
using AIStudio.Tools.Media;
using AIStudio.Tools.OpenXml;
using AIStudio.Tools.Rust;
using AIStudio.Tools.Word;

namespace AIStudio.Assistants.BatchProcessing;

Expand All @@ -18,6 +22,62 @@ public partial class AssistantBatchProcessing

private string? ValidateFilePatterns(string patterns) => FileNamePatterns.Validate(patterns);

/// <summary>
/// Checks that the chosen template suits the format of the result files.
/// </summary>
/// <remarks>
/// Whether the file can be found is checked once when the run starts, see CanWriteIntoResultFilesTemplateAsync:
/// a template on a network share which is not connected can take a while to answer, and the form validates
/// with every change.
/// </remarks>
private string? ValidateResultFormatTemplate(string path)
{
if (string.IsNullOrWhiteSpace(path) || this.resultFileFormat.FormatTemplateFilter is not { } kind || FileTypes.IsAllowedPath(path, kind))
return null;

return string.Format(TA("Please choose a template of this format ({0})."), string.Join(", ", kind.FilterExtensions.Select(extension => $".{extension}")));
}

/// <summary>
/// Checks once before the first document that the template of the result files can be found and fits into the
/// memory of this computer, see WordDocumentFile.MaxTemplateXmlSize.
/// </summary>
/// <remarks>
/// Checking per document would spend time and tokens on answers which cannot be written anywhere. On a
/// background thread, because a template on a network share which is not connected can take a while to answer.
/// A template which cannot be read otherwise passes: each document then fails with the reason, which the log keeps.
/// </remarks>
/// <param name="templatePath">The path of the template.</param>
/// <returns>Whether the run may start.</returns>
private async Task<bool> CanWriteIntoResultFilesTemplateAsync(string templatePath)
{
if (!await Task.Run(() => File.Exists(templatePath)))
{
this.Logger.LogWarning("The template '{TemplatePath}' of the result files cannot be found.", templatePath);
this.AddInputIssue(TA("The template of the result files cannot be found. Please check the template, or write the result files without one."));
return false;
}

long xmlSize;
try
{
xmlSize = await Task.Run(() => PackageSkeleton.XmlSizeOf(templatePath));
}
catch (Exception e)
{
this.Logger.LogWarning(e, "Cannot read the size of the template '{TemplatePath}' of the result files.", templatePath);
return true;
}

var maxXmlSize = WordDocumentFile.MaxTemplateXmlSize;
if (xmlSize <= maxXmlSize)
return true;

this.Logger.LogWarning("The XML of the template '{TemplatePath}' of the result files takes {XmlSize} bytes, more than the {MaxXmlSize} bytes which fit into the memory of this computer.", templatePath, xmlSize, maxXmlSize);
this.AddInputIssue(string.Format(TA("Without its pictures, the template of the result files takes {0} MB. With the memory of this computer, AI Studio can write into templates of up to {1} MB. Please choose another template or write the result files without one."), DocumentMemoryBudget.MegabytesOf(xmlSize), DocumentMemoryBudget.MegabytesOf(maxXmlSize)));
return false;
}

private string? ValidateCsvFileName(string fileName)
{
if (string.IsNullOrWhiteSpace(fileName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ protected override async Task OnDefaultsAppliedAsync()
private DataDocumentAnalysisPolicy? selectedPolicy;
private BatchProcessingOutputMode outputMode = BatchProcessingOutputMode.INDIVIDUAL_FILES;
private FileExportFormat resultFileFormat = FileExportFormat.MARKDOWN;

/// <summary>
/// The format template the result files are written into; empty for none.
/// </summary>
/// <remarks>
/// It stays when the user switches to a format which takes no template, so that it is back when they switch
/// again; ResultFilesTemplatePath tells whether it applies.
/// </remarks>
private string resultFormatTemplatePath = string.Empty;

private string resultColumnHeader = string.Empty;
private string csvFileName = string.Empty;
private BatchProcessingCsvSeparator csvSeparator = BatchProcessingCsvSeparator.SEMICOLON;
Expand All @@ -142,6 +152,16 @@ protected override async Task OnDefaultsAppliedAsync()
/// </summary>
private int numTooLargeFiles;

/// <summary>
/// The format template the result files of this run are written into; empty when Pandoc or AI Studio itself
/// writes them without one.
/// </summary>
/// <remarks>
/// A template applies only to individual result files of a format which takes templates, see
/// FileExportFormatExtensions.FormatTemplateFilter.
/// </remarks>
private string ResultFilesTemplatePath => this.outputMode is BatchProcessingOutputMode.INDIVIDUAL_FILES && this.resultFileFormat.FormatTemplateFilter is not null ? this.resultFormatTemplatePath : string.Empty;

/// <summary>
/// The header of the column of the results table that holds the AI answer.
/// </summary>
Expand Down Expand Up @@ -209,6 +229,7 @@ private void ApplyFormDefaults()
this.selectedPolicy = null;
this.outputMode = BatchProcessingOutputMode.INDIVIDUAL_FILES;
this.resultFileFormat = FileExportFormat.MARKDOWN;
this.resultFormatTemplatePath = string.Empty;
this.resultColumnHeader = string.Empty;
this.csvFileName = string.Empty;
this.csvSeparator = BatchProcessingCsvSeparator.SEMICOLON;
Expand All @@ -232,6 +253,7 @@ private void ApplyFormDefaults()
.FirstOrDefault(policy => policy.Id == settings.PreselectedPolicyId);
this.outputMode = settings.OutputMode;
this.resultFileFormat = settings.ResultFileFormat;
this.resultFormatTemplatePath = settings.ResultFormatTemplatePath;
this.resultColumnHeader = settings.ResultColumnHeader;
this.csvFileName = settings.CsvFileName;
this.csvSeparator = settings.CsvSeparator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@
Color="Color.Primary"
MaxHeight="@MenuDefaults.MAX_HEIGHT"
Disabled="@this.IsBusy(kind)">
@foreach (var format in FileExportFormat.DocumentFormats)
{
<MudMenuItem @key="format" OnClick="@(() => this.ExportAsync(kind, confirmed, format))" Icon="@format.Icon" Label="@format.Name"/>
}
<DocumentFormatMenuItems OnExport="@(choice => this.ExportAsync(kind, confirmed, choice.Format, choice.FormatTemplate))"/>
<MudDivider/>
@foreach (var format in FileExportFormat.TextFormats)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using AIStudio.Chat;
using AIStudio.Components;
using AIStudio.Dialogs;
using AIStudio.Settings;
using AIStudio.Tools.Services;

using Microsoft.AspNetCore.Components;
Expand Down Expand Up @@ -374,19 +375,20 @@ private async Task EditAsync(BflResultKind kind)
/// </summary>
/// <remarks>
/// The format knows who writes it, as in the chat: Pandoc writes documents and HTML, AI Studio itself writes
/// Markdown.
/// Markdown and fills a Word template.
/// </remarks>
/// <param name="kind">The kind of result.</param>
/// <param name="confirmed">The confirmed version.</param>
/// <param name="format">The format of the file.</param>
private async Task ExportAsync(BflResultKind kind, BflResultVersion confirmed, FileExportFormat format)
/// <param name="formatTemplate">The template to export into; null to write the document without one.</param>
private async Task ExportAsync(BflResultKind kind, BflResultVersion confirmed, FileExportFormat format, FormatTemplate? formatTemplate = null)
{
var fileName = $"{this.ProjectName} - {kind.Title}";
this.saving.Add(kind);
try
{
if (format.UsesPandoc)
await PandocExport.ToDocument(this.RustService, this.PandocAvailability, this.DisclosureService, kind.Title, format, new ContentText { Text = this.Shown(kind, confirmed.Text) }, fileName);
await DocumentExport.ToDocument(this.RustService, this.PandocAvailability, this.DisclosureService, kind.Title, format, new ContentText { Text = this.Shown(kind, confirmed.Text) }, fileName, formatTemplate);
else
await PlainFileExport.ToFile(this.RustService, kind.Title, format, this.DisclosureService.AddDisclosureToMarkdown(this.Shown(kind, confirmed.Text)), fileName);
}
Expand Down
Loading
Loading