Anna Sałacińska 1 Napisano 24 Czerwca 2021 Udostępnij Napisano 24 Czerwca 2021 w Podgląd wydruku Dzień dobry, próbuje wygenerować podgląd wydruku ale metoda podgląd za każdym razem zwraca mi "Odwołanie do obiektu nie zostało ustawione na wystąpienie obiektu." Niestety w dokumentacji nie mogę znaleźć nic na ten temat using (var sfera = uruchomSfere()) { IWydruki manager = sfera.PodajObiektTypu<IWydruki>(); using (IWydruk wydruk = manager.Utworz(TypWzorcaWydruku.FakturaSprzedazy)) { IDokumentySprzedazy dokumentySprzedazy = sfera.PodajObiektTypu<IDokumentySprzedazy>(); var fs = dokumentySprzedazy.Dane.Wszystkie().Where(w => w.NumerWewnetrzny.PelnaSygnatura == "FS 3/CENTRALA/2021").FirstOrDefault(); if (dokumentySprzedazy != null) { wydruk.ObiektDoWydruku = fs; wydruk.Podglad(); } } } Wyjątek Cytat „program.exe” (CLR v4.0.30319: program.exe): załadowano „C:\Users\...\Documents\source\repos\program\program\bin\Debug\InsERT.Mox.Printing.dll”. „program.exe” (CLR v4.0.30319: program.exe): załadowano „C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.ServiceProcess\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.ServiceProcess.dll”. „program.exe” (CLR v4.0.30319: program.exe): załadowano „C:\WINDOWS\Microsoft.Net\assembly\GAC_32\System.Printing\v4.0_4.0.0.0__31bf3856ad364e35\System.Printing.dll”. „program.exe” (CLR v4.0.30319: program.exe): załadowano „C:\Users\...\Documents\source\repos\program\program\bin\Debug\InsERT.Moria.API.Uprawnienia.dll”. „program.exe” (CLR v4.0.30319: program.exe): załadowano „C:\Users\...\Documents\source\repos\program\program\bin\Debug\Ionic.Zip.dll”. „program.exe” (CLR v4.0.30319: program.exe): załadowano „C:\Users\...\AppData\Local\Temp\nexo\Reports\0879415971760AF99B63CEA8CD3EE327541B92EB2018.2.3.0.dll”. Moduł został skompilowany bez symboli. „program.exe” (CLR v4.0.30319: program.exe): załadowano „C:\Users\...\Documents\source\repos\program\program\bin\Debug\InsERT.Moria.PolaWlasne.dll”. „program.exe” (CLR v4.0.30319: program.exe): załadowano „C:\Users\...\Documents\source\repos\program\program\bin\Debug\Stimulsoft.Data.dll”. „program.exe” (CLR v4.0.30319: program.exe): załadowano „C:\Users\...\Documents\source\repos\program\program\bin\Debug\Stimulsoft.Report.Wpf.dll”. „program.exe” (CLR v4.0.30319: program.exe): załadowano „C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationCore.resources\v4.0_4.0.0.0_pl_31bf3856ad364e35\PresentationCore.resources.dll”. Moduł został skompilowany bez symboli. Zgłoszony wyjątek: „System.NullReferenceException” w InsERT.Moria.Printing.Stimulsoft.dll „program.exe” (CLR v4.0.30319: program.exe): załadowano „C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Transactions.resources\v4.0_4.0.0.0_pl_b77a5c561934e089\System.Transactions.resources.dll”. Moduł został skompilowany bez symboli. System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Nieobsługiwany wyjątek</Description><AppDomain>program.exe</AppDomain><Exception><ExceptionType>System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Odwołanie do obiektu nie zostało ustawione na wystąpienie obiektu.</Message><StackTrace> w InsERT.Mox.Printing.Stimulsoft.StiPrintTask.Preview() w InsERT.Moria.Wydruki.Base.Wydruk`2.Podglad(TDoc obiektDoDrukowania) w InsERT.Moria.Wydruki.Base.Wydruk`2.InsERT.Moria.Wydruki.IWydruk.Podglad() w goSubiekt.Form1.button7_Click(Object sender, EventArgs e) w C:\Users\...\Documents\source\repos\program\program\Form1.cs:wiersz 1541 w System.Windows.Forms.Control.OnClick(EventArgs e) w System.Windows.Forms.Button.OnClick(EventArgs e) w System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) w System.Windows.Forms.Control.WmMouseUp(Message&amp; m, MouseButtons button, Int32 clicks) w System.Windows.Forms.Control.WndProc(Message&amp; m) w System.Windows.Forms.ButtonBase.WndProc(Message&amp; m) w System.Windows.Forms.Button.WndProc(Message&amp; m) w System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m) w System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m) w System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) w System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp; msg) w System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) w System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) w System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) w System.Windows.Forms.Application.Run(Form mainForm) w goSubiekt.Program.Main() w C:\Users\...\Documents\source\repos\program\program\Program.cs:wiersz 19</StackTrace><ExceptionString>System.NullReferenceException: Odwołanie do obiektu nie zostało ustawione na wystąpienie obiektu. w InsERT.Mox.Printing.Stimulsoft.StiPrintTask.Preview() w InsERT.Moria.Wydruki.Base.Wydruk`2.Podglad(TDoc obiektDoDrukowania) w InsERT.Moria.Wydruki.Base.Wydruk`2.InsERT.Moria.Wydruki.IWydruk.Podglad() w goSubiekt.Form1.button7_Click(Object sender, EventArgs e) w C:\Users\...\Documents\source\repos\program\program\Form1.cs:wiersz 1541 w System.Windows.Forms.Control.OnClick(EventArgs e) w System.Windows.Forms.Button.OnClick(EventArgs e) w System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) w System.Windows.Forms.Control.WmMouseUp(Message&amp; m, MouseButtons button, Int32 clicks) w System.Windows.Forms.Control.WndProc(Message&amp; m) w System.Windows.Forms.ButtonBase.WndProc(Message&amp; m) w System.Windows.Forms.Button.WndProc(Message&amp; m) w System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m) w System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m) w System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) w System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp; msg) w System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) w System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) w System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) w System.Windows.Forms.Application.Run(Form mainForm) w goSubiekt.Program.Main() w C:\Users\...\Documents\source\repos\program\program\Program.cs:wiersz 19</ExceptionString></Exception></TraceRecord> Wystąpił nieobsługiwany wyjątek typu „System.NullReferenceException” w InsERT.Moria.Printing.Stimulsoft.dll Odwołanie do obiektu nie zostało ustawione na wystąpienie obiektu. Program „[12776] program.exe” zakończył działanie z kodem -1 (0xffffffff). Co robię źle ? Link to postu
Paweł Kubacki 203 Napisano 25 Czerwca 2021 Udostępnij Napisano 25 Czerwca 2021 w Podgląd wydruku Aby wywołać podgląd wydruku trzeba uruchomić Sfere z dostępem do interfejsu użytkownika. Polecam w tym celu zapoznanie się z tematem "Pierwsze kroki" -> "Wykorzystanie interfejsu użytkownika" w pomocy do Sfery. 1 Link to postu
Polecane posty