0

I have a DataTable in my program which I have previously exported to excel using a CSV file. However, I want to conditionally format the backgroun colour of cells - which obviously needs a new approach.

The issue is this - the computer where the software will run does not have Excel. So I cannot go down the route of calling the Excel api.

Is there an easy way of doing this that I have missed? If not, is the format of Excel files published or how can I achieve this goal?

Thanks.


EDIT:

For anyone else that is interested, I eventually found this post which provides the simplest method I have found. Works with Excel 2003.

2 Answers 2

1

Which version of excel? If you need excel 2003, then take a look at : http://www.carlosag.net/Tools/ExcelXmlWriter/

If you're ok with excel 2007, then there's: http://excelpackage.codeplex.com/ (open source) or http://msdn.microsoft.com/en-us/library/bb448854.aspx (official MS product)

Sign up to request clarification or add additional context in comments.

Comments

0

Check out NPOI, which is a .NET port of POI, a free MS office interop library. It's powerful and fairly straightforward to learn (though the documentation is iffy). I would read through some of the past posts here on NPOI (there aren't all that many) to become familiar with a few frustrating gotchas that are not so much problems as things that are counterintuitive and not always obvious from the documentation.

But once you get past the lack of a good primer it's an awesome library.

I assume you're talking about xls format. If you can use the newer XML based xlsx format, it's a totally different problem. You just need to write XML, the format is available on Microsoft's web site. There may be are (see other answer) tools that can help with this, though personally, I always just use NPOI and write XLS files to be sure anyone can open them.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.