I want to show Mathematical formula in Report in my winform application. I am aware about RDLC but during my testing I found I was not able to show it correctly (As per understanding, please let me know if I missed something). I also tried setting Placeholder property in RDLC to HTML - Interpret html tags as styles, but in vain.
eg. While showing x a [x^a] I got is showing xa [showing side by side]
How can I be able to show this kind of mathematical formula in RDLC report. or can anyone suggest any good reporting service by which I can achieve this.
Thanks in anticipation.
I think the easiest/best/reliable solution would be to save Math formula's to image and include the images in the Report:
Online tool for generating mathematical equation image files
This is How to show images on an RDLC report
I use Roger's Online Equation Editor.
PNG, colors, transparent background and anti-aliasing are all included.
And used Converting math equations to C# for inline code math equations
Related
I am writing software which displays a lot of mathematical content. As in windows forms it is already hard to set a subscript or a Greek letter in a label, I am thinking of switching to WPF.
At the moment I am searching for the best way to render a mathematical expression, a formula or just a symbol inside my graphical user interface. They have to be shown in labels or drawn graphs/pictures. No live/just-in-time renderings but beautiful fix symbols.
What is the best way to do that? I thought, that MathML should be supported well, but I can't find a lot regarding that. I would be glad to hear some advice.
Here is, where I can get my symbols from (or what I would prefer):
LaTeX-code (First choice! Code is already there and same appearance in Software and documentation would be marvellous)
MathML-code (LaTeX-code in Word 2007 or higher -> Word equations -> copy as plain MathML to clipboard)
SVG (some rendering of LaTeX in Inkscape and export to XAML)
xmcd Files (Mathcad XML Document. Don't know how, but at least it's XML)
html Files (written by LaTeX->html or Mathcad->html
What I wouldn't consider personally, but maybe there are good solutions to:
Images (png-icons, pdf, dvi, eps, svg directly imported)
Symbols (like copy pasted from Character Map. Don't like the fonts, wouldn't find all I need and exchange of formula syntax would not be given)
I think using LaTeX, MathML or html would be great as they could be used for documentation as well. I also could think about exporting calculation results to *.tex files or internally generate graphics completely with LaTeX (tikz, pgfplots...)
Consider using open-source WPF-Math library (disclaimer: I'm its' current maintainer).
It can help you to display the LaTeX expression in a WPF window. It also uses vector graphic instead of bitmaps, so the formulae will scale nice on the modern displays.
I would go with pure xaml approach using datatemplates. There is no need for another vector format or rednering engine.
You can use datatemplate for each expression in expression tree. Using viewboxes you can achieve stretching, so topmost expressions will be larger then inner expressions. Your datatemplates will generate visual tree from you expression tree. I mean there will be contentpresenters inside contentpresenter.
The great advatage is that the expression visualisation can be responsive and interactive, just like math expression in MS Word, or Excel.
I could help you with implementation, since this is not trivial, if you are not familiar with wpf datatemplates
As far as I can see, the best rendering (on paper) is achieved with a late conversion from a vector file. I would prefer using either GDI+ (System.Drawing) or WPF (System.Media) to render a formula. Let me know if we can collaborate on a WPF solution.
I used https://github.com/std8590/xmcd2cs to convert most of my Mathcad xmcd files to C#.
Then I used the formulas in code and make the input variables available in UI.
I have a dot matrix printer and an already designed invoice.
How do I print the datagridview items in the specified section of the Invoice Template?
I searched alot for how to set boundaries in printdocument class for that purpose but I didn't found an answer. Please help...
My Application looks like this
The quickest way to generate a neatly formatted output is to use a reporting tool to layout your report and pass the data to it and let it worry about rendering to the printer.
There's Crystal Reports, Sql Server Reporting Services, ActiveReports.Net just to name a few.
I manage to do it by this method
I am creating an rdlc report in VS 2010 .
When I see my report in reportviewer it seems OK to me but when i export that report to PDF its format changes and reportviewer format do not match with PDF format....
I want to have same format in report
How can i resolve this problem....
This is a bit difficult to answer without knowing exactly what changes but I would assume this is down to page widths etc as thats one of the most common issues I've seen.
Your PDF is going to render the data in pages to fit on whatever the default is, probably A4 for uk or I believe Letter for USA, so the best way to get consistent results is to set the page size of your report to whatever size you are going to be printing it out on, and have fixed sizes, do not let things resize on their own.
If you want to update your answer with what is changing I can possibly help you more.
Can a crystal report be scaled to fit page?
I'm hoping to achieve something similar to Microsoft Excel's Scale To Fit feature wherein a large spreadsheet can be scaled to fit a 8.5"x 11" page.
(On MS Excel 2007 goto Page Layout > Scale To Fit).
Im searching of a way to make a large report fit into a smaller page during print.
for example a report designed in Legal(8.5"x 14") page must be able to shrink when print
previewed for Letter(8.5"x 11") page.
In my crystal report, it should be scaled to fit the page by default.
I was thinking maybe theres a Crystal Report Setting or C# code technique that I missed out.
Any hint or link to the right direction is appreciated.
Thanks!
If you change the paper size programmatically, you will lose some of the canvas (hence fields).
Moreover, I'm not aware of any native API calls to scale the report as you request.
Workarounds:
print the report to PDF. In my experience, the Acrobat viewer will automatically scale the document to 8.5" x 11". Take a look at the article I wrote about correcting the automatic scaling: Adobe Acrobat – Printing Legal Landscape Documents
export the report to Excel, then use its shrink-to-fit option.
create a custom printer driver (akin to MS XPS image writer) to scale the image before printing--clearly not an easy task
I've searched Stackoverflow and google and found many ways
how I can print stuff in C#.
The best way for me would be to populate blank white windows form
with some label, textbox and picturebox elements and print it as a windows form.
This way is very poor because it prints in 72 DPI, and is not flexible for multiple
pages print.
Next way that I found that would be good is using iTextSharp, but there is a problem
that iTextSharp only generates PDF-s, and you have to open it in PDF viewer and print
from there.
I love this way of thinking where I create a paragraph, and then fill it with text and graphic, so I found this thread
http://www.devarticles.com/c/a/C-Sharp/Printing-Using-C-sharp/
where it discusses how to create your own printing engine in C#, something like iTextSharp,
but very lightweight...
Now that I've said that, I want to know is there any ready to use printing engine that would be like iTextSharp, made for printing, not for PDF generation? What is the best way to print something, without using reporting services like CrystalReports.
I think Crystal Reports wouldn't work for my case cause I don't want to print generic reports, but some text and graphics that I need to dynamicaly generate every time I need to print.
I found that it was much easier to do printing using the printing stuff in WPF.
EDIT
XPS is the page description format that Microsoft included into .NET with .NET 3.0. It is nominally part of WPF, and is integrated with the WPF form layout model. But you can create XPS documents in memory and send them to printers, from any .NET app, including a WinForms App.
An example:
http://statestreetgang.net/post/2008/03/Creating-an-XPS-document-in-memory-via-the-DOM.aspx
It is approximately equivalent to the iTextSharp capability you explored, except:
you can do it all in memory if you like, no need to save to a filesystem file. Of course if you want to save to a filesystem file, you can do that too.
you don't need an external viewer in order to start the print.
If you are new in programming and you have some data like from Data Base, and you want to print it after retrieving it from Data Base. Then just follow this link it will guide you step by step.
Print Data in Dot Net (C#,Vb.net)