2016-03-07 40 views
8

Usługi raportowania 2016 (obecnie dostępne tylko jako podgląd techniczny) zawierają duże ulepszenia, w tym renderowanie i zgodność z HTML5. Zobacz: https://msdn.microsoft.com/en-us/library/ms170438.aspxUmieszczanie raportów SSRS 2016 na innej stronie bez elementu iframe?

Pragnę umieścić raporty SSRS 2016 na innej stronie internetowej w trybie macierzystym (bez SharePointa lub aspx, tylko czysty HTML5). Tradycyjną modą do tego jest użycie ramki iFrame. Jest to metoda w połowie drogi, ponieważ możliwe jest usunięcie paska narzędzi, ukrycie parametrów itp., Ale w efekcie tracimy dużo kontroli nad dokumentem. Jest to implementacja przekierowania z innej domeny, więc nie mogę manipulować zawartym dokumentem iFrame, jak chcę.

Czy istnieje oficjalny sposób osadzenia elementu raportu "natywnie"? Mogę wyobrazić opcję parametru adresu URL, taką jak rs:Format=REPORTDIV, która serwuje mi element html.

Próbowałem również pobrać raport jako obraz (rs:Format=IMAGE&rc:OutputFormat=PNG), ale wynikowy PNG ma ogromną białą ramkę (nawet przy ustawianiu tła przezroczystego w Konstruktorze raportów) wokół elementu raportu, który nie jest dozwolony.

+0

Dotychczas jedyną metodą opłacalne wydaje się być pobierania raportu jako obraz i ikonki cięcia go dopasuj swoją własną treść internetową: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/007396c2-3d51-465c-8ab8-157cd48ed373/embedding-ssrs-2016-reports-into-another-webpage -without-iframe? forum = SQLServer2016Preview – Wollan

+0

Zobacz https://blogs.msdn.microsoft.com/sqlrsteamblog/2016/03/18/sql-server-2016-rc1-whats-new-in-reporting-services/. Dołączanie 'rs: Embed = true' do URL-a IFrame wydaje się być" drogą do wyjścia ". –

+0

Czy możesz rozwiązać, jeśli tak, pls opublikuj odpowiedź, więc wszyscy się z tego uczymy, dzięki. –

Odpowiedz

2

To powinno zadziałać. Powinien działać poza środowiskiem, jak to osadza obrazy z pamięci zamiast pobierania ich z bazy danych

// Create service instance 
      ReportExecutionServiceSoapClient rsExec = new ReportExecutionServiceSoapClient(binding, endpoint); 
      rsExec.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; 
      rsExec.ChannelFactory.Credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials; 

      ReportingServices.Extension[] extentions = null; 
      ReportingServices.TrustedUserHeader trustedUserHeader = new ReportingServices.TrustedUserHeader(); 
      rsExec.ListRenderingExtensions(trustedUserHeader, out extentions); 
      string reportPath = "/Untitled"; 
      ExecutionInfo execInfo = new ExecutionInfo(); 
      ExecutionHeader execHeader = new ExecutionHeader(); 
      ReportingServices.ServerInfoHeader serverInfo = new ReportingServices.ServerInfoHeader(); 
      string historyID = null; 

      rsExec.LoadReport(trustedUserHeader, reportPath, historyID, out serverInfo, out execInfo); 

      //Get execution ID 
      execHeader.ExecutionID = execInfo.ExecutionID; 
      string deviceInfo = null; 
      string extension; 
      string encoding; 
      string mimeType; 
      ReportingServices.Warning[] warnings = new ReportingServices.Warning[1]; 
      warnings[0] = new ReportingServices.Warning(); 
      string[] streamIDs = null; 

      string format = "HTML5"; 
      Byte[] result; 
      rsExec.Render(execHeader, trustedUserHeader, format, deviceInfo, out result, out extension, out mimeType, out encoding, out warnings, out streamIDs); 

      var report = Encoding.UTF8.GetString(result); 
      int streamIdCount = streamIDs.Length; 
      Byte[][] imageArray = new Byte[streamIdCount][]; 
      String[] base64Images = new String[streamIdCount]; 
      for (int i = 0; i <= streamIdCount - 1; i++) 
      { 
       Byte[] result2; 
       string streamId = streamIDs[i]; 
       rsExec.RenderStream(execHeader, trustedUserHeader, format, streamId, deviceInfo, out result2, out encoding, out mimeType); 
       imageArray[i] = result2; 
       base64Images[i] = Convert.ToBase64String(result2); 
       string replace = string.Format("https://<reportserver>/ReportServer?%2FUntitled&rs%3ASessionID={0}&rs%3AFormat={1}&rs%3AImageID={2}", execInfo.ExecutionID, format, streamId); 
       string src = string.Format("data:{0};charset=utf-8;base64, {1}", mimeType, base64Images[i]); 
       report = report.Replace(replace, src); 
      } 
Powiązane problemy