1). In the ExecuteCore (Document document,ExportResult result) of a CustomExportTool, you can add your result to the ExportResult which is a container with the parts representing the result of an export tool.
Example:
protected override IEnumerable<object> ExecuteCore(Document document, ExportResult result)
{
ExportResultPart resultPart = result.AddPart(text + ".txt", new ContentType("text/plain"));
using (StreamWriter writer = new StreamWriter(resultPart.GetStream()))
{
writer.WriteLine("Hello");
writer.WriteLine("World!");
}
}
2). You can host the files created in the Web Player server in IIS and then create a text area in the analysis with a link to the file. This would work only with CustomTools<Tcontext> and not with CustomExportTool. This is because CustomExportTools are always executed inside what we call a "transient transactions". This means that any modifications of the document are roll-backed after execution of the tool.
Example:
public class SampleTool : CustomTool<Document>{
protected override IEnumerable<object> ExecuteCore(Document document)
{
string varurl = "http://google.com";
Page activePage = document.ActivePageReference;
bool exists = false;
foreach (Visual viz in activePage.Visuals)
{
if (viz.Title.Equals("Link to download"))
{
viz.As<HtmlTextArea>().HtmlContent = "<a href = \"" + varurl + "\">Click to open link" + "</a>";
}
}
if (!exists)
{
Visual dynamic = activePage.Visuals.AddNew(VisualTypeIdentifiers.HtmlTextArea);
dynamic.Title = "Link to download";
dynamic.As<HtmlTextArea>().HtmlContent = "<a href = \"" + varurl + "\">Click to open link" + "</a>";
}
}
}