When exporting a template with bookmarks to RTF the controls which contain bookmarks are not displayed

This happens because of the error in the export filter. The problem will be fixed in version 6.4 of the product. And for now you can use the following workaround:

1. Add two new classes to your project:

public class FixedRTFExportFilter : RtfExportFilter

{

    protected override void ExportDocument(PerpetuumSoft.Reporting.DOM.Document document, string fileName)

    {

        using (FileStream file = new FileStream(fileName, FileMode.Create))

        {

            PerformFixedExport(document, file);

        }

    }

 

    protected override void ExportDocument(PerpetuumSoft.Reporting.DOM.Document document, System.IO.Stream stream)

    {

        PerformFixedExport(document, stream);

    }

 

    private void PerformFixedExport(PerpetuumSoft.Reporting.DOM.Document document, System.IO.Stream stream)

    {

        using (MemoryStream ms = new MemoryStream())

        {

            base.ExportDocument(document, ms);

            ms.Position = 0;

            using (StreamReader reader = new StreamReader(ms))

            {

                string data = reader.ReadToEnd().Replace(@"\*\fldinst \\l"@"\*\fldinst HYPERLINK \\l");

                using(StreamWriter writer = new StreamWriter(stream))

                {

                    writer.Write(data);

                }

            }

        }

    }

}

 

public class FixedRtfExportFilterFactory : ExportFilterFactory

{

    static private FixedRtfExportFilterFactory factory;

 

    static public FixedRtfExportFilterFactory Factory

    {

        get

        {

            if (factory == null)

                factory = new FixedRtfExportFilterFactory();

            return factory;

        }

    }

 

    public override ExportFilter CreateFilter()

    {

        return new FixedRTFExportFilter();

    }

 

    public override string GetFilterName()

    {

        return "Rtf export filter";

    }

 

    public override string GetFilterFormat()

    {

        return "Rtf";

    }

 

    public override string GetFilterFileExtension()

    {

        return "rtf";

    }

}


2. In the constructor of the form that includes our components, you need to remove registration of the standard RTF filter and register a fixed version:
// Remove standard RTF export filter
ExportFilter.ExportFilters.Remove(RtfExportFilterFactory.Factory);
// Add fixed RTF export filter
ExportFilter.ExportFilters.Add(FixedRtfExportFilterFactory.Factory);

Add Feedback