I have already draw an excel chart with EPPlus in C# and I need to set Connect data points with line, in order to avoid empty cells affecting my chart.
As you can see in above image, there are two cells with no value (Green ones) and I checked the "Connect data points with line" in excel data options.
But working with EPPlus, I cant find the proper property to set that.
Unfortunately, your reported problem of EPPLus has not been resolved yet! So, as an alternative solution, switch cells whose data is null to #N/A.
In this case, Excel will correct the chart automatically.
Related
I have a problem about reading an excel file. If I save file as this picture
I receive an error because this column's values are
How can I resolve this?
Cells have value and formatting. The values of your cells are 10-digit numbers. They are displayed like in the first picture because column width is not enough to fit them.
How can we add a striped line to an Excel chart using C#?
I am able to create the chart using c# but I didn't get any clue how to add a striped line.
Please make some suggestions.
Thanks
Try this:
- add a data series with a steady value ( of 50 in your case )
- move the new data series to the secondary Y axis
- synchronize the maximum for both Y axes
- set Chart Type for the new data series to Line
- set the Line Style for the new data series to a dash type
I know this is not C#, but it is C# as much as you question is :)
When I have things like this, what I'm usually doing is I "manually" do all I have to do in Excel recording a macro with all the stuff. Then I just analyze the macro. You will find a lot of useful information there.
Good luck!
How do I identify merged cells in PowerPoint 2007? Is there anyway we could find a particular cell is merged.
In 2003 we tried to access the Fill.Visible property of a cell and when it throws an error we can identify the cell as a merged cell. How do we achive this in 2007?
It's tough. However, the best way I've found is to check the width of the cell. This code isn't the best as it catches every cell, but it could be a starting point for you:
Dim r As Row
Dim co As Column
Dim c As Cell
For Each co In tbl.Columns
For Each c In co.Cells
If c.Shape.Width <> co.Width Then
Debug.Print "Is merged cell"
End If
Next
Next
In a 2x2 table where cells 2.1 and 2.2 are merged (i.e. the second row is now one cell), this will print "Is merged cell" twice because internally the table still maintains cells 2.1 and 2.2. But it's a starting point as stated...
I think much better would be to compare c1.Left == c2.Left && c1.Top == c2.Top. This would mean that the 2 cells are merged. To traverse all the cells just once I just remove "duplicates" using LINQ's Distinct and custom Comparer.
Cells that are merged together will have the same cell.Shape.Name. Unfortunately while this works on PowerPoint 2003, you get NotImplementedException when asking for the name of these Shapes on PowerPoint 2007. I don't know about later versions.
Recently, I dug into the mystery of merged cells in the PowerPoint table.
I ended up figuring out my own methods to deal with merged cells.
Please refer to the following link:
https://stackoverflow.com/a/74563860/6354194
There are a few useful functions for merged cells:
test if the cell is merged
test if the cell is the first(Top-Left) cell of the merged area
get the index no. of the cells in the merged area, top to bottom, left to right
get the width and height of merged area
test if the given cells are within a merged area
We are trying to generate an excel sheet using a template. Normally we would have done have a basic "Save As" to save the file but the file size came up to be too high. So, now we're working on copying the used range of the original workbook to a new workbook.
The data is getting copied, along with the validations and formulae on using the PasteSpecial command, and all data and formatting is the same, other than the cell background and the font colours. They have almost inverted.
Please suggest how could i solve this.
Excel use colors from a palette of 56 colors (may be more in Excel 2007/2010) that can be changed using Tools/Options/Color.
You can copy colors from one workbook to another using:
Workbook1.Colors = Workbook2.Colors
By copying the palette, you will of course affect the colors of all UI elements in the target workbook, not just the range you're copying.
It worked this way, the propety Workbook.Colors wasn't there. The foolowing statement did the job for me
wb2.set_Colors(Missing.Value, wb.get_Colors(Missing.Value));
Thank you for the replies everyone.
I have a local report in a WinForms application that is giving me some trouble. On this report, I have a table and I am trying to change the BackgroundColor of the Detail row.
When I change it to "Red" and view the report, the row is Red as hoped for. When I export the report to Excel and PDF, the row is Red, too. So far, so good...
If, however, I change the row color to something like "DarkSeaGreen," it will display in my ReportViewer control ok and the PDF looks good, too, but the copy I exported to Excel just shows this row as gray.
I have tried out a few different colors... some work, some don't. I have also tried setting this property different Hex values; again, some work, some don't.
Has anyone experience this before? What is causing the colors to turn to gray when the report is exported to Excel?
Any assistance is greatly appreciated!
Edit: Also, the same colors that don't display in Excel don't print from the ReportViewer either... looks like Excel isn't the main culprit.
Have you tried using a hexidecimal value for your colour and see'ing if Excel picks it up. My guess is that Excel doesn't support the CSS colour naming codes.
Select your row, table, text box etc and set the colour to something like #2f4fa2 - see if that works in Excel.