jsReport Online with local templates store



  • Hello,

    We would like to use jsReport Online, but keep our templates local in our web app, git versioned (asp.net, azure web app).
    In other words, I could say we would use jsReport Online only for the rendering engine, and developer would use the jsReport Studio locally.
    Is that scenario possible ?
    How would templates get sent to jsReport Online ? Would we use the API to push them in a deployment steps ? Or would we send the whole template content with the request ?

    Sorry if this is all obvious, I'm starting my journey with jsReport :-)



  • You can either send the whole template in every request or implement a deployment step that will upload your templates to jsreportonline.

    How to import your templates into jsreport online....
    You can open jsreport studio, hit export and download zip that you can import to the jsreportonline.
    You can automate this using API calls, just check with F12 tools what is happening and do the same request.
    Or wait a few weeks with this, because we will soon provide single command in the cli that will automate this.
    https://github.com/jsreport/jsreport/issues/518



  • Thanks !

    I'm trying to follow this tutorial: https://www.youtube.com/watch?time_continue=465&v=qqTGQgkEHow
    At the 7:40 mark, it is shown how the templates get saved into the jsreport folder inside the project.
    When I try the same thing on my machine, the jsreport folder is being created under the bin/debug/ instead of the project folder.
    Am I missing something ?

    Here is my code:

    class Program
        {
            static async Task Main(string[] args)
            {
                Console.WriteLine("Initializing local jsreport.exe utility");
                var rs = new LocalReporting()
                    .RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "jsreport"))
                    .KillRunningJsReportProcesses()
                    .UseBinary(JsReportBinary.GetBinary())
                    .Configure(cfg => cfg.AllowedLocalFilesAccess().FileSystemStore().BaseUrlAsWorkingDirectory())
                    .AsWebServer()
                    .RedirectOutputToConsole()
                    .Create();
    
                await rs.StartAsync();
                
                Process.Start(new ProcessStartInfo("cmd", $"/c start http://localhost:5488"));
    
                Console.ReadKey();
    
                await rs.KillAsync();
    
                
            }
    
            
        }
    


  • There seem to be some changes in .net core and Directory.GetCurrentDirectory() now doesn't return project path.
    You need to pass your project path to the RunInDirectory

    You can try something like this

    var projectPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location.Substring(0, Assembly.GetEntryAssembly().Location.IndexOf("bin\\")));            
    var rs = new LocalReporting()
      .RunInDirectory(Path.Combine(projectPath, "jsreport"))
    ...
    

Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.