Example #1
0
        private static TextWriter CreateTextWriter(IItem item, BodyType type, bool update, out HtmlUpdateBodyCallback htmlUpdateBodyCallback)
        {
            Body body = IrmUtils.GetBody(item);
            BodyWriteConfiguration bodyWriteConfiguration = new BodyWriteConfiguration(type.ToStorageType());

            if (update && type == BodyType.Html)
            {
                htmlUpdateBodyCallback = new HtmlUpdateBodyCallback(item);
                bodyWriteConfiguration.SetHtmlOptions(HtmlStreamingFlags.None, htmlUpdateBodyCallback);
                return(body.OpenTextWriter(bodyWriteConfiguration));
            }
            htmlUpdateBodyCallback = null;
            return(body.OpenTextWriter(bodyWriteConfiguration));
        }