private void WriteFragments(HtmlFragment fragment, DocumentContainer parentContainer) { if (parentContainer != null) { foreach (var childFragment in fragment.Fragments) { var writer = HtmlWriterFactory.Find(childFragment); var ctrl = writer?.GetControl(childFragment); if (ctrl != null) { if (!parentContainer.CanContain(ctrl)) { var antecesorContainer = parentContainer.Find(ctrl); if (antecesorContainer == null) { continue; } else { parentContainer = antecesorContainer; } } var currentContainer = parentContainer.Append(ctrl); WriteFragments(childFragment, currentContainer); writer?.ApplyStyles(_docStyles, ctrl, childFragment); } } } }
protected override bool InternalRender(Microsoft.ReportingServices.OnDemandReportRendering.Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, ref Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream) { HtmlTextWriter htmlTextWriter = null; Html5ServerRenderer html5ServerRenderer = null; try { htmlTextWriter = HtmlWriterFactory.CreateWriter(report.Name, "text/html", createAndRegisterStream, StreamOper.CreateAndRegister); DeviceInfo deviceInfo2 = null; try { deviceInfo2 = new ServerDeviceInfo(); deviceInfo2.ParseDeviceInfo(deviceInfo, clientCapabilities); } catch (ArgumentOutOfRangeException innerException) { throw new ReportRenderingException(RenderRes.rrInvalidDeviceInfo, innerException); } bool onlyVisibleStyles = deviceInfo2.OnlyVisibleStyles; int totalPages = 0; if (renderProperties != null) { object obj = renderProperties["ClientPaginationMode"]; if (obj != null) { PaginationMode paginationMode = (PaginationMode)obj; if (paginationMode == PaginationMode.TotalPages) { object obj2 = renderProperties["PreviousTotalPages"]; if (obj2 != null && obj2 is int) { totalPages = (int)obj2; } } } } if (deviceInfo2.BookmarkId != null) { string uniqueName = null; SPBInteractivityProcessing sPBInteractivityProcessing = new SPBInteractivityProcessing(); int section = sPBInteractivityProcessing.ProcessBookmarkNavigationEvent(report, totalPages, deviceInfo2.BookmarkId, out uniqueName); if (uniqueName != null) { deviceInfo2.Section = section; deviceInfo2.NavigationId = uniqueName; } } try { html5ServerRenderer = CreateRenderer(report, reportServerParameters, deviceInfo2, deviceInfo, clientCapabilities, createAndRegisterStream, ref renderProperties, totalPages); } catch (InvalidSectionException innerException2) { throw new ReportRenderingException(innerException2); } html5ServerRenderer.Render(htmlTextWriter); html5ServerRenderer.UpdateRenderProperties(ref renderProperties); return(false); } finally { html5ServerRenderer?.Dispose(); htmlTextWriter?.Flush(); } }