Click here to Skip to main content
15,894,410 members
Articles / Programming Languages / C#

A Very Easy to Use Excel XML Import-Export Library

Rate me:
Please Sign up or sign in to vote.
4.18/5 (86 votes)
25 Nov 2008CPOL13 min read 648.7K   19.6K   356  
Import export library for the Excel XML format, which reduces a programmer's work to the bare minimum.
using System.Drawing;

namespace Yogesh.ExcelXml
{
	/// <summary>
	/// Style font options
	/// </summary>
	public interface IFontOptions
	{
		/// <summary>
		/// Name of font
		/// </summary>
		string Name { get; set; }
		/// <summary>
		/// Size of font
		/// </summary>
		int Size { get; set; }
		/// <summary>
		/// Bold?
		/// </summary>
		bool Bold { get; set; }
		/// <summary>
		/// Underline?
		/// </summary>
		bool Underline { get; set; }
		/// <summary>
		/// Italic?
		/// </summary>
		bool Italic { get; set; }
		/// <summary>
		/// Strikeout?
		/// </summary>
		bool Strikeout { get; set; }
		/// <summary>
		/// Font foreground color
		/// </summary>
		Color Color { get; set; }
	}

	/// <summary>
	/// Cell interior options
	/// </summary>
	public interface IInteriorOptions
	{
		/// <summary>
		/// Cell fill color
		/// </summary>
		Color Color { get; set; }
		/// <summary>
		/// Pattern color
		/// </summary>
		Color PatternColor { get; set; }
		/// <summary>
		/// Pattern style
		/// </summary>
		Pattern Pattern { get; set; }
	}

	/// <summary>
	/// Cell alignment options
	/// </summary>
	public interface IAlignmentOptions
	{
		/// <summary>
		/// Vertical alignment settings
		/// </summary>
		VerticalAlignment Vertical { get; set; }
		/// <summary>
		/// Horizontal alignment settings
		/// </summary>
		HorizontalAlignment Horizontal { get; set; }

		/// <summary>
		/// Cell indent
		/// </summary>
		int Indent { get; set; }
		/// <summary>
		/// Rotation angle
		/// </summary>
		int Rotate { get; set; }

		/// <summary>
		/// Wrap enabled?
		/// </summary>
		bool WrapText { get; set; }
		/// <summary>
		/// Shrink the text to fit cell?
		/// </summary>
		bool ShrinkToFit { get; set; }
	}

	/// <summary>
	/// Cell border options
	/// </summary>
	public interface IBorderOptions
	{
		/// <summary>
		/// Border sides
		/// </summary>
		BorderSides Sides { get; set; }

		/// <summary>
		/// Width of border
		/// </summary>
		int Weight { get; set; }

		/// <summary>
		/// Border line style
		/// </summary>
		Borderline LineStyle { get; set; }

		/// <summary>
		/// Border color
		/// </summary>
		Color Color { get; set; }
	}

	/// <summary>
	/// Style settings container
	/// </summary>
	public interface IStyle
	{
		/// <summary>
		/// Font options
		/// </summary>
		IFontOptions Font { get; set; }

		/// <summary>
		/// Alignment options
		/// </summary>
		IAlignmentOptions Alignment { get; set; }

		/// <summary>
		/// Cell fill options
		/// </summary>
		IInteriorOptions Interior { get; set; }

		/// <summary>
		/// Cell border options
		/// </summary>
		IBorderOptions Border { get; set; }

		/// <summary>
		/// Cell display format
		/// </summary>
		DisplayFormatType DisplayFormat { get; set; }

		/// <summary>
		/// Custom display format string
		/// </summary>
		string CustomFormatString { get; set; }
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
India India

Comments and Discussions