Compare SSRS report values with C# variables - c#

I have to compare data contained in rendered SSRS report (chart and tablix values for example) with variables stored in a C# application. How can it be done?
So far I know only about generating report in Xml and parsing the Xml to get the desired data. Is there an easier way to achieve that without any user interaction? Alternatively, is there a way to drop report chart/tablix data to an array or list in C#?

You have one special requirement there... it might help if you tell us why you want this, because there may well be other solutions to your actual problem.
Having said that, if you want to "compare data contained in rendered SSRS reports" to "variables stored in C#", you probably have the best approach already. Given that approach, you seem to suppose that there's user interaction needed to generate the XML, but it's not: there's the SSRS Web Service where you can run reports without users intervening. The render method allows you to specify the format:
Format
Type: System.String
The format in which to render the report. This argument maps to a rendering extension. Supported extensions include XML, NULL, CSV, IMAGE, PDF, HTML4.0, HTML3.2, MHTML, EXCEL, and Word.
Guessing at your actual case being the need to check if the report data is "correct" by comparing it to C#-generated data, I'd suggest a different approach though. Place as much data-logic as you can in Views or Stored Procs, use those in your reports, and in C# compare your calculated results to the results read from the View through something like ADO.NET. Much easier than parsing SSRS XML reports (though a bit less reliable, because SSRS may still screw up interpretation of the data).

Related

Generating report or spreadsheet from simple XML listing of data

I have XML objects that hold form data from a web application. These are as simple as can be for an xml format, a demonstrative example would be:
<data>
<patientFirstName>Bob</patientFirstName>
<patientLastName>Bobson</patientLastName>
</data>
and unfortunately due to humans beyond my control, roughly 150 other potential fields for the current "document".
The primary goal is to transfer this data from XML to a more "human-friendly" format such as a spreadsheet or PDF, etc..
I have tried using a DataSet as the source for a DataGrid and producing an html table. This works for a browser, and technically loads in Excel - but Excel gives a file type error, as the file is not in Excel format, it is literally an HTML table.
Is there any way to use the .net framework, or other MS objects whether managed or (preferably) unmanaged to take XML or a DataSet and turn it into a useable file format by typical office applications?
Is there a way to use SSRS without SQL queries or files? My big issue is this is a small Information System that does many things dynamically. I have seen examples of creating Excel spreadsheets using a file on the disk...but it is 2019 - I will allow my code to create or read files, the concept of a file is quite obsolete and a major source of security dilemmas.
In a perfect world I would want to create a decent looking report form template and simply bind certain nodes to their respective node in the XML. This would seem like something that many people would want to do, and as if it would be easy to implement, but search as much as I may and I find 99 terrible ways to pretend to make an Excel file and not 1 decent one. SSRS would seem like a lovely option if I could request to use a premade template and pump XML into it or a DataSet from a middleware server - though my issue is that it seems to be dumbed-down to the point it is designed to do ALL the work in some not-very-flexible manner.
If all else fails, might there be some MS functionality for pagination that I can use to create my own mini-report generator? I feel I may be forced to..
Please understand I am not looking to hand-parse markup in C# - in unmanaged C++ I would consider it, but C# becomes very slow when you start doing things "by hand" as opposed to using objects and their methods.
.net 4.5+

SSRS .net PDF to Image from SQL

I have looked and there doesnt seem to be anything around to do this.
I have a database with a varbinary column that contains a PDF.
I want to display this as an image in SSRS.
I can't find any way with ghostscript or spire.pdf etc (the free options) that allow you to pass a stream as the pdf input, and then output the images, they all seem to need an actual file.
Googling this gives a codeproject example from 2009 which uses a component you now have to buy, plus sqlclr which seems overly complicated.
I just want a .net class i can build and reference in my SSRS rdl file which i can pass the field as the result of the sql query and get back a list of images (1 per page)
Instead of trying to display PDF stored in VARBINARY(MAX) directly in SSRS, I would try to obtain the images before generating the report:
1) use a tool to generate an image from a PDF (e.g. ImageMagick). More details about this conversion can be found here.
2) Display images in SSRS from VARBINARY(MAX) using this tutorial.
This means to have some redundancy (extra space needed), but reports will generate faster.

Document search and add engine web application

I want to develop a asp.net web application which should do the following task
a) user should be able to add content to the document. Content to be added can include text as well as image, screen shots etc.
b) user should be able to search based on some keywords. when searching with the keyword appropriate content along with images(if any) should be shown to user.
I am not sure what should be the proper approach for this. One way i think is to store text content in some xml file and later search for keywords by going though each node of xml and displaying. but i am not sure how to attach image content with xml. Also this method doesn't seem to be nice and efficient if with time document size increases a lot.
Anyone please suggest some proper way to do above requirement. Any hint would be appreciated.
Split it to two tasks. Editation and search.
Full text search is solved problem. Simply use Sphinx Search and you are done. Sphinx is simple to use and can do everything you will need. It has MySQL interface (your app connects to sphinx the same way as to second MySQL database).
Editation is a bit more complicated. If I understand correctly, you want multiple users to edit single document concurrently.
I recommend using websockets to notify other clients about changes in document. Long-polling and Server Sent Events have ugly side effects, like stopping browser from making another requests to server. To implement client side in Javascript, I would use React, Angular or similar framework to make updates as easy as possible.
Server side requires modification-friendly representation of a document, so if one user changes one part, and another user another part, your app should be able to merge changes. Changing completely different parts is easy, but it may be tricky to change the same paragraph or document node. Exact representation of each change depends on format of your document.
I do not see much benefits of using XML rather than any other format. It may be practical for document representation, but it will not help with merging of colliding modifications. I would start with plain array of strings, each representing a single paragraph. Extending it to full XML document is the easy part, once two users can edit the same paragraph.
To store images in XML, simply store files using their hash as a file name and then use such name to link the file in XML. Git does the same thing and it works nicely. You may want to count references to identify unused files.

How to create a multiple page invoice in asp.net c#?

I am thoroughly confused with something I want to do and am looking for some advice.
One of my client has to produce monthly invoice detailing all of the company expenditure, and two other such invoices. The client is sure that he only needs these invoices - and they are extremely simple enough to produce as far as logic is concerned.
Now, to make the actual invoice, I don't really want to use reporting solutions like Telerik, SSRS etc.. as I think they are an overkill for my purpose. At the same time, I am not sure how I can get the printer to print the invoices in a neat pages without cutting off anything.
I am very tempted to just give the output in a webpage and ask my client to print them off from there.
Am I not looking at this the right way? Is this possible?
I could use ITextSharp or something to produce pdf's.. In fact, I think I will go ahead with this if it isn't possible to just output to html page and get the printer to recognize the page breaks somehow.
Because this is a very small job, I don't want to spend too much time on it as the cost of this freelance project is minimal too.
The reason printing to a new page is important is that my client has a few shops he deals with and he would want to print each of his customers their own invoices. I can get him to produce each customer's invoice separately and print them but it is not ideal way to deal with it.
thanks
There is a css property which should tell a browser to break a page: page-break-before.
But if you have a a wide list of browsers to support, it would be better to get some HTML to PDF conversion library or really use iTextSharp (as far as I know there is even a module/class which allows to conver HTML to PDF with iTextSharp) as printing web pages has many issues.
In the past, when I wanted to create a reusable document, I used Word or Excel XML formats.
See: http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats
They are easy to create and tweak, then all you have to do is recreate the dynamic parts in your code. All you have to do is save the document in Office XML format, then open it up in word pad to see where to make your changes.
SSRS has a drag and drop interface for designing reports and has a PDF output option. If the data is in a SQL server database then even with the learning curve it should be easier to do SSRS reports.

Justify text in a Report

In my work we need to generate contract documents that dynamically extract information from the database to personalize client related information.
These documents not only have text, but also they need tables with dynamic rows (ie.: shows some products owned by the client). These tables can be placed in different parts of the document and they can be between paragraphs.
The important thing is that: the texts must be justified (a legal requeriment of my country)
We do these documents with Reporting Services and export them to PDF, but this tool doesn't provide justified text.
i did some googleing and found that there is no way to justify text in Reporting Services.
Is there another way to do this? if not, can you give me some alternative to solve this issue?
We work with ASP.NET in C#.
Thanks in advance
You might be able to export them to Word, where I believe you would have greater control over the justification, then convert the Word document to a PDF.

Categories

Resources