I'm currently working on a C# program to write a set of test results to a spreadsheet on Google Drive, and under the current format the cell to which I'm writing has one data value in the cell and the other 5 in a note (not a comment) on the cell.
EX: 1.8 visible in the cell, and when the cursor hovers over said cell, a small box appears to the side containing
Average: 1810 ms
Highest: 1921 ms
Lowest: 1708 ms
StdDev: 78 ms
Median: 1787 ms
My program currently can access and write to the cells in the Google spreadsheet, but I can't find a way to create a note for the cell and write to that. Any help is welcome.
If you take a look at this, setting a comment in the described way will actually add a note to the cell. This might be a known issue for them but I guess works in your favor. Hope this helps. :)
Related
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.
Using Visual Studio 2015 and C# here. I have a DataGridView based on one of my SQL tables. I have added in a DataGridViewImageColumn which is blank at the minute.
I need to somehow display an image in this cell based on the criteria which is ;
IF cell = Y then display image, if blank show nothing. I am relatively new to C# still if anybody could point me in the right direction that would be really helpful.
I'm not asking for somebody to write code for me, just if there is a function to go by that will help I can then look in to.
And YES I have of course googled it many times and tried various bits of code amending to fit my criteria / solution, I cannot get any of them to work.
I need to write an app in C# that opens an Excel file which has rows that have either ayellow, blue or just the plain white background color, then only returns the values in Column 'A' that does NOT have a white background(just yellow or blue values in Column A should be returned).
I found code on SO to get the data from the Spreadsheet, but I don't have any info on the background color.
I can confirm, Chris Walsh's answer is good. Definitely use the Microsoft Office Primary Interop Assemblies:
http://www.microsoft.com/download/en/details.aspx?id=3508
You can also take the road of Visual Studio Tools for Office but I recommend the former, it's easier and cleaner.
Here's another code example that shows how you can SET a cell color, so you have a good sample of how to access that property.
http://forums.asp.net/t/1310118.aspx/1?Changing+Cell+color+of+excel+sheet+programatically+
I'm creating a newspaper authoring system. Today I'm using Aspose.Words library to generate newspaper using Docx format as output, based on a lot of other documents as input.
The basic idea is to load a lot of articles documents into a List, then generate a final docx with newspaper.
We need to get the total height of a text (with images and tables) inside columns. As libraries like Aspose.Words deal with Docx format like DOM, there isn't way to know how text will be arranged inside columns. Then I can't know the real height.
We've worked in our own way to get this height. I'm using MeasureString() function from System.Drawing.Graphics namespace. It returns width and height used by string and I can estimate how many lines (and points or inches) it will use inside a column.
But it is very poor and we need a more decent solution. We are thinking to use OpenXML SDK to get this Height, can we?
Aspose.Words doesn't support a way to know it and all Render classes are private to the library.
Can you think a new way to get this height?
Thank you,
Daniel Koch
This property isn't exposed in Open XML or the SDK (or VBA/VSTO for that matter). How exactly the height is calculated is not in any documentation. Possibly the way you are doing it is a way to proceed.
Another possible way is to put your TextColumns in a Table Column/Cell and grab that height (but if it is two text columns in the cell and the first one "fills" the cell top to bottom and the second one doesn't, you'll still have the issue of not being able to calculate the size of the second one).
I have almost the same problem that you have.. But in my case I'm dealing with Questions inside an Test Exam..
Well nowadays, we are using RTF to build the questions and a RichTextBox the measure the height.. Just like that (http://blogs.technet.com/david_bennett/archive/2005/04/06/403402.aspx)..
And I wanna to migrate to DOCX.. But still no luck on how to measure the question with tables and images.. :-(
Right now I'm studying the Document Members (http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word._document_members.aspx), to try to do with Word Automation..
Regards,
Bruno
Thank all for answer.
I finished it changing Aspose.Words to PDFLib. Now I can control pages, columns or anything using Postscript Points.
We keep Aspose.Words only to content import, but it isn't indicate to print newsletter.
I can already populate the data into the spreadsheet, create the chart based on the range I select. However, when it comes to formatting the actual chart I feel a bit lost as their are so many options!!
It is an xlCylinderBarStacked type chart. I simply need to make the color of the bars a nice light orange and make the background a light blue fading into white at the bottom.
Any idea's how to do this?
Just to close this question off. I played around a little with the properties and the following achieved the gradient effect on the background of the chart.
xlChart.Interior.Color = ColorTranslator.ToOle(Color.LightSkyBlue);
chart.ChartArea.Fill.TwoColorGradient(
Microsoft.Office.Core.MsoGradientStyle.msoGradientHorizontal,
1);
One good trick with Excel and other VBA-enabled apps is to manually create the formatting/content you require using the Excel GUI, whist recording a 'macro'. Once this is done you can then inspect the generated VBA to see how to use the API to acheive the same results programmatically. You will of course have to do some translation from VBA to C# but essentially the same methods should work.