Features (C# / netframework)
Note
This demo is available in your FlexCel installation at <FlexCel Install Folder>\samples\csharp\VS2022\netframework\20.Reports\B0.Features Page and also at https://github.com/tmssoftware/TMS-FlexCel.NET-demos/tree/master/csharp/VS2022/netframework/Modules/20.Reports/B0.Features Page
Overview
This is a real world demo, showing how we create the "features" HTML sheet you can find at
https://www.tmssoftware.com/flexcel/featuresflexcel.htm
Concepts
Everything in this demo is shown in more detail somewhere else. This is just a showcase of a real application of a FlexCel report, but anyway there are some ideas worth noting.
We use the Image Fit tag in the image to autofit the containing cell to the height of the image. Bus as we also need to autofit the whole row, we need to do an autofit with a "Dont Shrink" option on the rows. If we didn't, when autofitting the rows the images would get outside their cells again.
We use Intelligent Page Breaks to have a nice PDF output.
As we wanted to use Access so we can distribute this demo easily to you, we did not store the images in the database. (Access is not good at storing images). So we saved the images in a folder, and used an user defined function to load them and feed the report.
Files
AssemblyInfo.cs
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("(c) 2002 - 2024 TMS Software")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("7.21.0.0")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
Form1.cs
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Diagnostics;
using System.Reflection;
using System.Data.OleDb;
using FlexCel.Core;
using FlexCel.XlsAdapter;
using FlexCel.Report;
using FlexCel.Render;
using FlexCel.Pdf;
using System.Globalization;
using System.Xml;
namespace FeaturesPage
{
public partial class mainForm: System.Windows.Forms.Form
{
public mainForm()
{
InitializeComponent();
//initialize the db.
dbconnection.ConnectionString = dbconnection.ConnectionString.Replace("Features.mdb", Path.Combine(DataPath, "features.mdb"));
ResizeToolbar(mainToolbar);
FlexCelConfig.DpiForImages = 192; //Make the exports in hidpi.
}
private static void LaunchFile(string f)
{
if (f != null)
{
using (Process p = new Process())
{
p.StartInfo.FileName = f;
p.StartInfo.UseShellExecute = true;
p.Start();
}
}
}
private void ResizeToolbar(ToolStrip toolbar)
{
using (Graphics gr = CreateGraphics())
{
double xFactor = gr.DpiX / 96.0;
double yFactor = gr.DpiY / 96.0;
toolbar.ImageScalingSize = new Size((int)(24 * xFactor), (int)(24 * yFactor));
toolbar.Width = 0; //force a recalc of the buttons.
}
}
private void button2_Click(object sender, System.EventArgs e)
{
Close();
}
private static string DataPath
{
get
{
return Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), ".."), "..") + Path.DirectorySeparatorChar;
}
}
private string ResultPath
{
get
{
string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
return Path.Combine(BasePath, "Features");
}
}
private XlsFile Export(DataSet data)
{
using (FlexCelReport Report = new FlexCelReport(true))
{
Report.AddTable(data);
Report.SetUserFunction("Images", new ImagesImp());
XlsFile Xls = new XlsFile(true);
Xls.Open(Path.Combine(DataPath, "Features Page.template.xls"));
Report.Run(Xls);
return Xls;
}
}
private DataSet LoadDataSet()
{
DataSet Result = new DataSet();
featuresAdapter.Fill(Result, "Features");
categoriesAdapter.Fill(Result, "Categories");
hyperlinksAdapter.Fill(Result, "Hyperlinks");
Result.Relations.Add(Result.Tables["Categories"].Columns["CategoryId"], Result.Tables["Features"].Columns["CategoryId"]);
Result.Relations.Add(Result.Tables["Features"].Columns["FeaturesId"], Result.Tables["Hyperlinks"].Columns["FeaturesId"]);
return Result;
}
private void btnExportExcel_Click(object sender, System.EventArgs e)
{
string XlsPath = Path.Combine(ResultPath, "FeaturesFlexCel.xls");
using (DataSet data = LoadDataSet())
{
XlsFile Xls = Export(data);
Directory.CreateDirectory(ResultPath);
Xls.Save(XlsPath);
}
if (MessageBox.Show("Do you want to open the generated file?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
LaunchFile(XlsPath);
}
}
private void btnExportHtml_Click(object sender, System.EventArgs e)
{
string MainHtmlPath = Path.Combine(ResultPath, "featuresflexcel.htm");
using (DataSet data = LoadDataSet())
{
XlsFile Xls = Export(data);
Directory.CreateDirectory(ResultPath);
using (FlexCelHtmlExport html = new FlexCelHtmlExport(Xls, true))
{
html.ImageResolution = 192;
html.ImageBackground = Color.White; //Since we are not setting html.FixIE6TransparentPngSupport, we must ensure tehre are no transparent images.
TStandardSheetSelector SheetSelector = new TStandardSheetSelector(TSheetSelectorPosition.Top);
SheetSelector.SheetSelectorEntry += new SheetSelectorEntryEventHandler(SheetSelector_SheetSelectorEntry);
SheetSelector.CssGeneral.Main += "font-family:Verdana;font-size:10pt;";
html.ExportAllVisibleSheetsAsTabs(ResultPath, "Features", ".htm", null, null, SheetSelector);
//Rename the first tab so it is "featuresflexcel.htm";
string[] Sheets = html.GeneratedFiles.GetHtmlFiles();
File.Delete(MainHtmlPath);
File.Move(Sheets[0], MainHtmlPath);
}
}
if (MessageBox.Show("Do you want to open the generated file?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
LaunchFile(MainHtmlPath);
}
}
static void SheetSelector_SheetSelectorEntry(object sender, SheetSelectorEntryEventArgs e)
{
//We will rename the first sheet, so we need to update the links here.
if (e.ActiveSheet == 1) e.Link = "featuresflexcel.htm";
}
private void btnExportPDF_Click(object sender, System.EventArgs e)
{
string PdfPath = Path.Combine(ResultPath, "FeaturesFlexCel.pdf");
using (DataSet data = LoadDataSet())
{
XlsFile Xls = Export(data);
Directory.CreateDirectory(ResultPath);
using (FlexCelPdfExport pdf = new FlexCelPdfExport(Xls, true))
{
using (FileStream pdfStream = new FileStream(PdfPath, FileMode.Create))
{
pdf.BeginExport(pdfStream);
pdf.FontMapping = TFontMapping.ReplaceAllFonts;
pdf.Properties.Subject = "A list of FlexCel.NET features";
pdf.Properties.Author = "TMS Software";
pdf.Properties.Title = "List of FlexCel.NET features";
pdf.PageLayout = TPageLayout.Outlines;
pdf.ExportAllVisibleSheets(false, "Features");
pdf.EndExport();
}
}
}
if (MessageBox.Show("Do you want to open the generated file?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
LaunchFile(PdfPath);
}
}
class ImagesImp: TFlexCelUserFunction
{
public ImagesImp()
{
}
public override object Evaluate(object[] parameters)
{
if (parameters == null || parameters.Length != 1)
throw new ArgumentException("Bad parameter count in call to Images() user-defined function");
string ImageFilename = Path.Combine(Path.Combine(DataPath, "images"), "Features" + Convert.ToString(parameters[0], CultureInfo.InvariantCulture) + ".png");
if (File.Exists(ImageFilename))
{
using (FileStream fs = new FileStream(ImageFilename, FileMode.Open))
{
byte[] Result = new byte[fs.Length];
fs.Read(Result, 0, Result.Length);
return Result;
}
}
return null;
}
}
}
}
Form1.Designer.cs
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Diagnostics;
using System.Reflection;
using System.Data.OleDb;
using FlexCel.Core;
using FlexCel.XlsAdapter;
using FlexCel.Report;
using FlexCel.Render;
using FlexCel.Pdf;
using System.Globalization;
using System.Xml;
namespace FeaturesPage
{
public partial class mainForm: System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
private System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
private System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;
private System.Data.OleDb.OleDbCommand oleDbDeleteCommand1;
private System.Data.OleDb.OleDbConnection dbconnection;
private System.Data.OleDb.OleDbDataAdapter categoriesAdapter;
private System.Data.OleDb.OleDbDataAdapter featuresAdapter;
private System.Data.OleDb.OleDbCommand oleDbSelectCommand2;
private System.Data.OleDb.OleDbCommand oleDbInsertCommand2;
private System.Data.OleDb.OleDbCommand oleDbUpdateCommand2;
private System.Data.OleDb.OleDbCommand oleDbDeleteCommand2;
private System.Data.OleDb.OleDbCommand oleDbSelectCommand3;
private System.Data.OleDb.OleDbDataAdapter hyperlinksAdapter;
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(mainForm));
this.label1 = new System.Windows.Forms.Label();
this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand();
this.dbconnection = new System.Data.OleDb.OleDbConnection();
this.oleDbInsertCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbUpdateCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbDeleteCommand1 = new System.Data.OleDb.OleDbCommand();
this.categoriesAdapter = new System.Data.OleDb.OleDbDataAdapter();
this.featuresAdapter = new System.Data.OleDb.OleDbDataAdapter();
this.oleDbDeleteCommand2 = new System.Data.OleDb.OleDbCommand();
this.oleDbInsertCommand2 = new System.Data.OleDb.OleDbCommand();
this.oleDbSelectCommand2 = new System.Data.OleDb.OleDbCommand();
this.oleDbUpdateCommand2 = new System.Data.OleDb.OleDbCommand();
this.oleDbSelectCommand3 = new System.Data.OleDb.OleDbCommand();
this.hyperlinksAdapter = new System.Data.OleDb.OleDbDataAdapter();
this.mainToolbar = new System.Windows.Forms.ToolStrip();
this.toolStripButton4 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.mainToolbar.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(179, 69);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(200, 48);
this.label1.TabIndex = 4;
this.label1.Text = "Files will be saved under a \"Features\" Folder in under where the application is r" +
"unning.";
//
// oleDbSelectCommand1
//
this.oleDbSelectCommand1.CommandText = "SELECT Caption, CategoryId, CategoryName, Description FROM Categories";
this.oleDbSelectCommand1.Connection = this.dbconnection;
//
// dbconnection
//
this.dbconnection.ConnectionString = resources.GetString("dbconnection.ConnectionString");
//
// oleDbInsertCommand1
//
this.oleDbInsertCommand1.CommandText = "INSERT INTO Categories(Caption, CategoryName, Description) VALUES (?, ?, ?)";
this.oleDbInsertCommand1.Connection = this.dbconnection;
this.oleDbInsertCommand1.Parameters.AddRange(new System.Data.OleDb.OleDbParameter[] {
new System.Data.OleDb.OleDbParameter("Caption", System.Data.OleDb.OleDbType.VarWChar, 255, "Caption"),
new System.Data.OleDb.OleDbParameter("CategoryName", System.Data.OleDb.OleDbType.VarWChar, 255, "CategoryName"),
new System.Data.OleDb.OleDbParameter("Description", System.Data.OleDb.OleDbType.VarWChar, 0, "Description")});
//
// oleDbUpdateCommand1
//
this.oleDbUpdateCommand1.CommandText = resources.GetString("oleDbUpdateCommand1.CommandText");
this.oleDbUpdateCommand1.Connection = this.dbconnection;
this.oleDbUpdateCommand1.Parameters.AddRange(new System.Data.OleDb.OleDbParameter[] {
new System.Data.OleDb.OleDbParameter("Caption", System.Data.OleDb.OleDbType.VarWChar, 255, "Caption"),
new System.Data.OleDb.OleDbParameter("CategoryName", System.Data.OleDb.OleDbType.VarWChar, 255, "CategoryName"),
new System.Data.OleDb.OleDbParameter("Description", System.Data.OleDb.OleDbType.VarWChar, 0, "Description"),
new System.Data.OleDb.OleDbParameter("Original_CategoryId", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "CategoryId", System.Data.DataRowVersion.Original, null),
new System.Data.OleDb.OleDbParameter("Original_Caption", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Caption", System.Data.DataRowVersion.Original, null),
new System.Data.OleDb.OleDbParameter("Original_Caption1", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Caption", System.Data.DataRowVersion.Original, null),
new System.Data.OleDb.OleDbParameter("Original_CategoryName", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "CategoryName", System.Data.DataRowVersion.Original, null),
new System.Data.OleDb.OleDbParameter("Original_CategoryName1", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "CategoryName", System.Data.DataRowVersion.Original, null)});
//
// oleDbDeleteCommand1
//
this.oleDbDeleteCommand1.CommandText = "DELETE FROM Categories WHERE (CategoryId = ?) AND (Caption = ? OR ? IS NULL AND C" +
"aption IS NULL) AND (CategoryName = ? OR ? IS NULL AND CategoryName IS NULL)";
this.oleDbDeleteCommand1.Connection = this.dbconnection;
this.oleDbDeleteCommand1.Parameters.AddRange(new System.Data.OleDb.OleDbParameter[] {
new System.Data.OleDb.OleDbParameter("Original_CategoryId", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "CategoryId", System.Data.DataRowVersion.Original, null),
new System.Data.OleDb.OleDbParameter("Original_Caption", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Caption", System.Data.DataRowVersion.Original, null),
new System.Data.OleDb.OleDbParameter("Original_Caption1", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Caption", System.Data.DataRowVersion.Original, null),
new System.Data.OleDb.OleDbParameter("Original_CategoryName", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "CategoryName", System.Data.DataRowVersion.Original, null),
new System.Data.OleDb.OleDbParameter("Original_CategoryName1", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "CategoryName", System.Data.DataRowVersion.Original, null)});
//
// categoriesAdapter
//
this.categoriesAdapter.DeleteCommand = this.oleDbDeleteCommand1;
this.categoriesAdapter.InsertCommand = this.oleDbInsertCommand1;
this.categoriesAdapter.SelectCommand = this.oleDbSelectCommand1;
this.categoriesAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Categories", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("Caption", "Caption"),
new System.Data.Common.DataColumnMapping("CategoryId", "CategoryId"),
new System.Data.Common.DataColumnMapping("CategoryName", "CategoryName"),
new System.Data.Common.DataColumnMapping("Description", "Description")})});
this.categoriesAdapter.UpdateCommand = this.oleDbUpdateCommand1;
//
// featuresAdapter
//
this.featuresAdapter.DeleteCommand = this.oleDbDeleteCommand2;
this.featuresAdapter.InsertCommand = this.oleDbInsertCommand2;
this.featuresAdapter.SelectCommand = this.oleDbSelectCommand2;
this.featuresAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Features", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("Caption", "Caption"),
new System.Data.Common.DataColumnMapping("CategoryId", "CategoryId"),
new System.Data.Common.DataColumnMapping("Description", "Description"),
new System.Data.Common.DataColumnMapping("FeaturesId", "FeaturesId")})});
this.featuresAdapter.UpdateCommand = this.oleDbUpdateCommand2;
//
// oleDbDeleteCommand2
//
this.oleDbDeleteCommand2.CommandText = "DELETE FROM Features WHERE (FeaturesId = ?) AND (Caption = ?) AND (CategoryId = ?" +
")";
this.oleDbDeleteCommand2.Parameters.AddRange(new System.Data.OleDb.OleDbParameter[] {
new System.Data.OleDb.OleDbParameter("Original_FeaturesId", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "FeaturesId", System.Data.DataRowVersion.Original, null),
new System.Data.OleDb.OleDbParameter("Original_Caption", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Caption", System.Data.DataRowVersion.Original, null),
new System.Data.OleDb.OleDbParameter("Original_CategoryId", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "CategoryId", System.Data.DataRowVersion.Original, null)});
//
// oleDbInsertCommand2
//
this.oleDbInsertCommand2.CommandText = "INSERT INTO Features(Caption, CategoryId, Description) VALUES (?, ?, ?)";
this.oleDbInsertCommand2.Parameters.AddRange(new System.Data.OleDb.OleDbParameter[] {
new System.Data.OleDb.OleDbParameter("Caption", System.Data.OleDb.OleDbType.VarWChar, 255, "Caption"),
new System.Data.OleDb.OleDbParameter("CategoryId", System.Data.OleDb.OleDbType.Integer, 0, "CategoryId"),
new System.Data.OleDb.OleDbParameter("Description", System.Data.OleDb.OleDbType.VarWChar, 0, "Description")});
//
// oleDbSelectCommand2
//
this.oleDbSelectCommand2.CommandText = "SELECT Caption, CategoryId, Description, FeaturesId FROM Features order by Positi" +
"onInSheet";
this.oleDbSelectCommand2.Connection = this.dbconnection;
//
// oleDbUpdateCommand2
//
this.oleDbUpdateCommand2.CommandText = "UPDATE Features SET Caption = ?, CategoryId = ?, Description = ? WHERE (FeaturesI" +
"d = ?) AND (Caption = ?) AND (CategoryId = ?)";
this.oleDbUpdateCommand2.Parameters.AddRange(new System.Data.OleDb.OleDbParameter[] {
new System.Data.OleDb.OleDbParameter("Caption", System.Data.OleDb.OleDbType.VarWChar, 255, "Caption"),
new System.Data.OleDb.OleDbParameter("CategoryId", System.Data.OleDb.OleDbType.Integer, 0, "CategoryId"),
new System.Data.OleDb.OleDbParameter("Description", System.Data.OleDb.OleDbType.VarWChar, 0, "Description"),
new System.Data.OleDb.OleDbParameter("Original_FeaturesId", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "FeaturesId", System.Data.DataRowVersion.Original, null),
new System.Data.OleDb.OleDbParameter("Original_Caption", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Caption", System.Data.DataRowVersion.Original, null),
new System.Data.OleDb.OleDbParameter("Original_CategoryId", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "CategoryId", System.Data.DataRowVersion.Original, null)});
//
// oleDbSelectCommand3
//
this.oleDbSelectCommand3.CommandText = "SELECT FeaturesId, HiperlinksId, LinkName, Url FROM Hyperlinks";
this.oleDbSelectCommand3.Connection = this.dbconnection;
//
// hyperlinksAdapter
//
this.hyperlinksAdapter.SelectCommand = this.oleDbSelectCommand3;
this.hyperlinksAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Hyperlinks", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("FeaturesId", "FeaturesId"),
new System.Data.Common.DataColumnMapping("HiperlinksId", "HiperlinksId"),
new System.Data.Common.DataColumnMapping("LinkName", "LinkName"),
new System.Data.Common.DataColumnMapping("Url", "Url")})});
//
// mainToolbar
//
this.mainToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButton4,
this.toolStripButton3,
this.toolStripButton2,
this.toolStripButton1});
this.mainToolbar.Location = new System.Drawing.Point(0, 0);
this.mainToolbar.Name = "mainToolbar";
this.mainToolbar.Size = new System.Drawing.Size(528, 38);
this.mainToolbar.TabIndex = 5;
this.mainToolbar.Text = "mainToolbar";
//
// toolStripButton4
//
this.toolStripButton4.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton4.Image")));
this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton4.Name = "toolStripButton4";
this.toolStripButton4.Size = new System.Drawing.Size(78, 35);
this.toolStripButton4.Text = "Save to Excel";
this.toolStripButton4.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
this.toolStripButton4.Click += new System.EventHandler(this.btnExportExcel_Click);
//
// toolStripButton3
//
this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image")));
this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton3.Name = "toolStripButton3";
this.toolStripButton3.Size = new System.Drawing.Size(94, 35);
this.toolStripButton3.Text = "Export to HTML";
this.toolStripButton3.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
this.toolStripButton3.Click += new System.EventHandler(this.btnExportHtml_Click);
//
// toolStripButton2
//
this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image")));
this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton2.Name = "toolStripButton2";
this.toolStripButton2.Size = new System.Drawing.Size(82, 35);
this.toolStripButton2.Text = "Export to PDF";
this.toolStripButton2.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
this.toolStripButton2.Click += new System.EventHandler(this.btnExportPDF_Click);
//
// toolStripButton1
//
this.toolStripButton1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Size = new System.Drawing.Size(59, 35);
this.toolStripButton1.Text = " E&xit ";
this.toolStripButton1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
this.toolStripButton1.Click += new System.EventHandler(this.button2_Click);
//
// mainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(528, 126);
this.Controls.Add(this.label1);
this.Controls.Add(this.mainToolbar);
this.Name = "mainForm";
this.Text = "Features FlexCel";
this.mainToolbar.ResumeLayout(false);
this.mainToolbar.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private ToolStrip mainToolbar;
private ToolStripButton toolStripButton4;
private ToolStripButton toolStripButton3;
private ToolStripButton toolStripButton2;
private ToolStripButton toolStripButton1;
}
}
Program.cs
using System;
using System.Windows.Forms;
namespace FeaturesPage
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new mainForm());
}
}
}