Excel inetrop Graph printing - c#

I am printing a chart using excel inter OP in c#. The values are filled in the excel sheet and the graph is plot based on that. Every thing is working fine. when I am printing the graph, there is a problem in that The axis values are repeated. What will be a solution?

I found the solution. It can easily done in excel by "format axis" option.

Related

EPPlus not calculating existing formulas

I've a spreadsheet with a lot of formulas and need to pass it some data, trigger calculations for a whole worksheet and extract the results. No formulas are being created or edited using EPPLus. Just using the existing one in the spreadsheet. Pretty straightforward...
However, I'm having a lot of issues calculating simple formulas already existing in my spreadsheet. I'm seeing a lot of weird behavior and I'm confused as of what I'm doing wrong, something I'm missing or if I don't use the right approach with EPPlus.
Some of the issues are:
Formulas not calculated properly (for instance: in a cell in Excel, I have =B1+B2. Using EPPlus and Calculate(), I'm getting the value of B2 only...)
the formulas is being re-written... (for instance, in a cell in Excel, I have =B2-B1. Using EPPlus and Calculate(), also extracting the formulas seen by EPPLus, I'm getting B1-B2 and the results are sometime B1-B2 but sometimes B2-B1....)
Multiplication aren't even calculated at all. (for instance: in a cell in Excel, I have =B1*B2. Using EPPlus and Calculate(), I'm always getting 0 and not error are being triggered)
So many weird behaviors... Could you please give me some pointers ?
I created a simple demo project if it can help highlight these issues. Play with the formulas in Excel and check if when running the app, you get consistent results.
Thank you for your help

How to Make a Box and Whisker Plot in Excel with EPPLus?

I have a C#/ASP.NET program that exports and excel file using EPPlus. I would like to incorporate a box-and-whisker plot into my excel file. However, it doesn't seem to be a default chart type in EPPlus when I look at the options under eChartType, does anyone know how to get one of these charts into the exported excel file.
Thank you!
So after more research it looks like the answer is no. Box Plots weren't added into Excel until the 2016 update and EPPlus is based on earlier versions. However, this pdf from the NI describes how to approximate a box and whisker plot using a stacked bar chart and I suspect it would be possible to recreate this process using EPPlus.

Exporting C# Lists to DataGridView

I am working on converting large data collection text files to excel. I have been able to successfully read-in and manipulate a text file, but am having difficulty on exporting it to excel.
I currently have data like coordinates in separate lists (x coordinate in a list, y coordinates in another list), I want it so that when the data is viewed in excel that the x and y coordinates are displayed in separate columns. I have looked online and saw a lot of people recommend DataGridView, but I am not familiar with it, and after reading the documentation, still don't understand it. I was wondering what the best approach is to convert these lists into columns in an excel file. Thanks for your suggestions!
Assuming you have some data in list objects, you should be able to create Excel files as described in Create Excel (.XLS and .XLSX) file from C#.

How to create an Excel Pie Chart using Infragistics and c#?

I'm developing a web site using c# and MVC4. In one of the sections I have a couple of pie charts that are created using highcharts lib and are based on a table of totals next to the charts.
I need to export to excel both the table with the totals and the charts, and I need to do it in a way in which, once exported, if the table changes in excel the graph will also be updated inside the spreadsheet.
My company is using Infragistics to export to excel, so exporting the table is not a problem, but I'm not sure how to export the pie charts.
I saw this example where a pivot table is created and feed to the table, but I noticed that it is using native excel libraries instead of Infragistics, I've been trying to migrate this but can't seem to find the equivalent to Excel.Application inside Infragistics lib.
Another solution that occur to me is that maybe I can enter a formula inside a cell and have it create the pie chart but I don't think this is possible since, if I'm not wrong, the pie chart is not even included in a cell, but it is a graphic that floats inside the spreadsheet.
So if anyone has had any experience drawing a pie chart from c# to excel using Infragistics and can point me in the right direction would be much appreciated.
Thanks,
I am a developer at Infragistics and work on the Excel library. Currently, charts will be round-tripped when a file is loaded and saved, but they cannot be manipulated or created at run-time in our object model. You can submit a feature request for this ability here: http://ideas.infragistics.com/
Using Infragistics, I don't know if you can create an Excel pie chart, but if you want to create it in a web or windows application, use this:
InfragisticsĀ® Chart

importing excel data while retaining formatting

Is it possible to import excel data to display using C# in any view(data grid etc ..) while retaining formatting like Bold, italic and strikethrough, throughout the document? I am making a Windows form application. My data is in an excel sheet, I want to display it in grid view or any other while retaining the formatting.
Well, there are some ways that I can think of but neither of them are very pretty at all and they would not be very effecient.
1) Parse the excel file cell by cell using Excel Interop. (Very nasty)
2) If you can convert the excel file to Excel XML you could then write say a XSLT to parse the file to pull styling data much more quickly.
Of course getting the styling data out is one thing. Applying it can be a whole other experience. Once you get the styling you have to make sure you apply the values to all the correct columns. Again very nasty and alot of parsing.
However since you did not say whether this was a web or desktop app you could always just embedd an excel control (on the web side) to display the data which may solve your problem. On a desktop app you are probably in for a world of pain trying to do what I describe above.
Maybe somebody will have a better answer but that's what I got.
SpreadsheetGear for .NET can load Excel workbooks and provides access to formatted text values as well as cell formatting such as fonts and colors.
SpreadsheetGear also comes with a Windows Forms spreadsheet control which will allow users to display, edit, format, calculate, print, etc... workbooks with formatting, charts, etc... intact.
If you are building an ASP.NET application, you can use SpreadsheetGear to open a workbook and generate an image of cells and / or charts as shown on our "Excel Chart and Range Imaging Samples" page here
You can download the free trial here if you want to try it out.
Disclaimer: I own SpreadsheetGear LLC

Categories

Resources