Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Thursday, March 27, 2008

Murach's C# 2008 published March 20

Mike Murach and Associates has just published a 2008 edition of their core C# book, "Murach's C# 2008." It's described in detail at the Murach web site:

http://www.murach.com/books/cs08/index.htm

It teaches how to develop Windows forms applications for business the way the best professionals do. To do that, it incorporates the features that have made earlier editions such popular choices among developers.

#1: It focuses on the essential skills that C# developers need every day

That may sound obvious. But too often, critical skills are glossed over or ignored in C# training.

So as this book teaches how to use Visual Studio 2008 and C# 2008 to create business applications, it covers the skills that developers need most on the job. That includes skills like how to validate input data, how to work with different data types, how to use arrays and collections, how to do structured exception handling, and how to read and write text, binary, and XML files.

#2: The OOP section deals with business objects, not cats and dogs

Many books explain object-oriented programming by using examples that are meant to be easily understood, like illustrating objects by creating animal classes such as mammals, cats, and dogs. However, the analogy breaks down as developers try to figure out how to apply it to business applications.

So this book presents business objects like customers, invoices, and products to show how OOP is applied in the real world. Likewise, it explains critical concepts like inheritance, polymorphism, and interfaces within the context of business applications so there's no confusion.

#3: There's a 4-chapter section on database programming

Because database handling is so critical in business applications, this book presents more coverage than is usual in introductory texts.

To begin, it teaches how to prototype database applications using rapid application development tools like the data sources feature, datasets, and bound controls. But beyond that, it shows developers how to start using ADO.NET to work directly with databases for more processing control than the RAD tools offer.

#4: It provides practical coverage of new features, especially LINQ

LINQ is the big news in C# 2008. Using constructs that are built into the C# language, developers can now use the same language to access a variety of data sources from their applications, from databases to arrays to XML files. The introductory chapter on LINQ in this book gives you a practical overview that will prepare you for more in-depth LINQ training.

#5: Complete applications show how all the pieces interact

One key to mastering C# development is to have plenty of applications that show how the features you're learning interact and what problems you might run into as you work on your own. So this book shows complete Windows forms applications for everyday business functions. These can be downloaded for free from the Murach web site, along with coding starts for the practice exercises in the book.

#6: The paired-pages format lets developers set their own pace

Murach books have a distinctive format, where each two-page spread presents a single topic. Both beginning and experienced developers find that this format makes it easy to focus on the information they need, whether they're using the book for training or reference.


"Murach's C# 2008" is available from all major retail outlets and directly from the publisher at the Murach web site:

http://www.murach.com

Monday, February 4, 2008

Convert a Multipage TIFF to PDF in .NET

Introduction
This article shows you how to create a PDF document from a multipage TIFF document in both C# and VB.NET using TallPDF.NET 2.0.

Sample Files

Download Code

Download code + resources (C# and VB.NET)

How it works
Basically, there three steps involved in the conversion:
  1. Get the number of frames.
  2. Add each frame to a document.
  3. Write the document.

1. Get the number of frames
A TIFF image can have multiple frames (pages). The input TIFF document in this sample has 4 frames. To retrieve the number of frames, use ImageShape.GetFrameCount(). This method has three overloads, allowing you to specify the image as a path, a stream or a System.Drawing.Bitmap object.

2. Add each frame to a document.
The next step is to create a new document and add a new page for each frame. We already know the number of frames so we can use a for-next loop to iterate over the frames.

3. Write the document.
Call Document.Write to write the PDF document to disk.

TallPDF.NET Sample Code
The easiest way to implement this using TallPDF is to create a new section for each frame. This ensures the original size of each image is retained and no scaling or clipping will occur.

[C# Sample Code]


//1. Get number of pages/images used in TIFF file
int frameCount = ImageShape.GetFrameCount( tiffPath );

//2. Add a section for each frame

// Create new (Pdf)document
Document doc = new Document();

// Iterate over frames
for ( int frameIndex=0; frameIndex < frameCount; frameIndex++ )
{
//Create a section and add it to the document.
Section section = doc.Sections.Add();
section.StartOnNewPage = true;

//Set Margins to zero; the image will span the entire page
section.LeftMargin = 0;
section.RightMargin = 0;
section.TopMargin = 0;
section.BottomMargin = 0;

// Load the frame into an Image paragraph
Image frame = new Image( tiffPath, frameIndex );

//Set PageSize from the Image dimensions
section.PageSize.Width = frame.Width;
section.PageSize.Height = frame.Height;

//Add the image to the section
section.Paragraphs.Add( frame );
}

// 3. Stream the PDF to a file
using( FileStream fs = new FileStream( "out.pdf", FileMode.Create ) )
{
//Write the file
doc.Write( fs );
}
[VB.NET]

'1. Get number of pages/images used in TIFF file
Dim frameCount As Integer = ImageShape.GetFrameCount(tiffPath)

' 2. Add a section for each frame

' Create a new TallPDF document
Dim doc As Document = New Document

' Iterate over the frames
Dim frameIndex As Integer
For frameIndex = 0 To frameCount - 1 Step 1

'Create a section and add it to the document.
Dim section As Section = doc.Sections.Add()
section.StartOnNewPage = True

'Set Margins to zero; the image will span the entire page
section.LeftMargin = 0
section.RightMargin = 0
section.TopMargin = 0
section.BottomMargin = 0

' Load the frame into an Image paragraph
Dim frame As New Image(tiffPath, frameIndex)

' Set PageSize from the Image dimensions
section.PageSize.Width = frame.Width
section.PageSize.Height = frame.Height

' Add the image to the section
section.Paragraphs.Add(frame)

Next frameIndex

'3. Stream the PDF to a file
Dim fs As FileStream = New FileStream("out.pdf", FileMode.Create)

Try

'Write the file
doc.Write(fs)

Finally

fs.Close()

End Try

Using PDFKit.NET
To implement this with PDFKit.NET we need a slightly different approach. PDFKit.NET has a page-based object model as opposed to TallPDF.NET's flow model. So we'll add a new page for each frame and use an ImageShape to place the frame on that page.

[C#]

//1. Get number of pages/images used in TIFF file
int frameCount = ImageShape.GetFrameCount( tiffPath );

//2. Add a page for each frame
// Create new (Pdf)document
Document doc = new Document();
// Iterate over frames
for ( int frameIndex=0; frameIndex < frameCount; frameIndex++ )
{
// Load the frame into an Image paragraph.
ImageShape frame = new ImageShape( tiffPath, frameIndex );

// Create a new page with the same size as the image.
Page page = new Page( frame.Width, frame.Height );
doc.Pages.Append( page );

//Add the image to the page
page.Underlay.Add( frame );
}

// 3. Stream the PDF to a file
using( FileStream fs = new FileStream( "out.pdf", FileMode.Create ) )
{
//Write the file
doc.Write( new BinaryWriter( fs ) );
}

[VB.NET]

'1. Get number of pages/images used in TIFF file
Dim frameCount As Integer = ImageShape.GetFrameCount(tiffPath)

' 2. Add a section for each frame

' Create a new TallPDF document
Dim doc As Document = New Document

' Iterate over the frames
Dim frameIndex As Integer
For frameIndex = 0 To frameCount - 1 Step 1

' Load the frame into an Image paragraph.
Dim frame As New ImageShape(tiffPath, frameIndex)

' Create a new page with the same size as the image.
Dim page As New Page(frame.Width, frame.Height)
doc.Pages.Append(page)

'Add the image to the page
page.Underlay.Add(frame)

Next frameIndex

'3. Stream the PDF to a file
Dim fs As FileStream = New FileStream("out.pdf", FileMode.Create)

Try

'Write the file
doc.Write(New BinaryWriter(fs))

Finally

fs.Close()

End Try

Imaging considerations
In this article we've used images based on files because TallPDF.NET and PDFKit.NET are highly optimized to work with files and streams. Older versions of both components (before TallPDF.NET 2.0.24 and PDFKit.NET 1.0.24) were based on GDI+ Bitmaps (System.Drawing.Bitmap). While quite flexible, GDI+ also introduces performace and quality issues. GDI+ uses a lot of resources to hold entire bitmaps in memory, often uncompressed (!). In addition to this, GDI+ has a nasty habit of converting image data to whatever format is best suited for on screen display, meaning that the actual color values in the image may change (!).

Using files and streams allows for efficient seeking and caching, resulting in greater performance. In addition to this, the image processing subsystem is specificaly designed not to modify the image data itself. So, when ever possible, use images from files or streams.

About TallComponents
TallComponents specializes in .NET PDF components. You can visit TallComponents at http://www.tallcomponents.com/. Here you can download evaluations for all our PDF-related .NET components and get support.


Copyright © 2001-2005 TallComponents BV

How to Save an Image in a SQL Server Database

Most of the web applications have a lot of images used in it. These images are usually stored in a web server folder and they are accessed by giving the relative path to the file with respect to the root folder of the website. .Net being the platform for distributed application now, ASP.Net can be used to store images that are small to be stored in a database like SQL Server 2000 and later versions. For this purpose the SQL Server database provides a data type called “image” which is used to store images in the database.

To access these images stored in the database we will be using the ADO.Net classes. To find out how to insert and retrieve an image in to the SQL Server database, you can create a .aspx page which can have a HTMLInputFile control which is used to select the image file that is to be saved in the database. You can also create a textbox control in which you can add the image name or some comment or an image id for the image saved. Use a button control to upload the image to the database. Namespaces like System.Data.SqlClient, System.Drawing, System.Data, System.IO, and System.Drawing.Imaging are used in this task.

In the OnClick property of the button you can write the following code to upload an image to the database.

// create a byte[] for the image file that is uploaded
int imagelen = Upload.PostedFile.ContentLength;
byte[] picbyte = new byte[imagelen];
Upload.PostedFile.InputStream.Read(picbyte, 0, imagelen);

 



// Insert the image and image id into the database
SqlConnection conn = new SqlConnection(@"give the connection string here...");

 



try
{
conn.Open ();
SqlCommand cmd = new SqlCommand ("insert into ImageTable " +
" (ImageField, ImageID) " +
" values (@pic, @imageid)",
conn);
cmd.Parameters.Add ("@pic", picbyte);
cmd.Parameters.Add ("@imageid", lblImageID.Text);
cmd.ExecuteNonQuery ();
}
finally
{
conn.Close();
}
You can also write the above code in a function and call that function in the OnClick event of the upload button. The code given above performs the following steps in the process of inserting an image into the database.

1. Get the content length of the image that is to be uploaded
2. Create a byte[] to store the image
3. Read the input stream of the posted file
4. Create a connection object
5. Open the connection object
6. Create a command object
7. Add parameters to the command object
8. Execute the sql command using the ExecuteNonQuery method of the command object
9. Close the connection object

To retrieve the image from the SQL Database you can perform the following steps.

1. Create a MemoryStream object. The code can be something like, MemoryStream mstream = new MemoryStream ();

2. Create a Connection object

3. Open the connection to the database

4. Create a command object to execute the command to retrieve the image

5. Use the command object’s ExecuteScalar method to retrieve the image

6. Cast the output of the ExecuteScalar method to that of byte[] byte[] image = (byte[]) command.ExecuteScalar ();

7. Write the stream mstream.Write (image, 0, image.Length);

8. Create a bitmap object to hold the stream Bitmap bitmap = new Bitmap (stream);

9. Set the content type to “image/gif” Response.ContentType = "image/gif";

10. Use the Save method of the bitmap object to output the image to the OutputStream. bitmap.Save (Response.OutputStream, ImageFormat.Gif);

11. Close the connection

12. Close the stream mstream.Close();
Using the above steps you can retrieve and display the image from the database to the web page.

You can use these algorithms and take advantage of the “image” data type available in the SQLServer 2000 database to store small images that correspond to a particular record in the table of the database. This method of storing avoids the tedious task of tracking the path of the web folder if the images are stored in a web folder.

Visit A Guide to .NET for a complete introduction to .NET framework. Learn about ASP.NET, VB.NET, C# and other related technologies.

Sunday, January 6, 2008

Free eBooks from Microsoft Press

Microsoft Press has made three books available in PDF format to download for free. These books include:

Friday, December 21, 2007

Microsoft releases XNA Game Studio 2.0

The release of XNA Game Studio 2.0 is now available for you to download!

What’s New with XNA Game Studio?

  • Support for all versions of Visual Studio 2005 (Standard, Professional, etc).
  • New interface for managing your Xbox 360.
  • Managing and building content is easier.
  • Project templates for content importers and processors.
  • New ability to set parameters on Content Processors to enable you to configure how content is processed.

What is new in the XNA Framework?

  • Use Xbox LIVE to create multiplayer games using the new networking APIs.
  • Create audio more effectively using the new XACT editor.
  • Host XNA Framework games easily inside a Windows Form.
  • Use the virtualized GraphicsDevice
  • New flexible render targets that are consistent and easier to use. Xbox 360 and Windows now supports multiple render targets.
  • Nest one component inside another component with improvements in GameComponent.

For more information and to download XNA Game Studio 2.0, visit the XNA Creator's Club.

Thursday, December 6, 2007

Learn to Program Language Integrated Query with C# with new book on LINQ

A new book on Language Integrated Query, titled LINQ has been announced by Packt. LINQ is a new feature in Visual Studio 2008 that extends its query capabilities, using C# and Visual Basic.

Visual Studio 2008 comes with LINQ provider assemblies that enable the use of LINQ with data sources such as in-memory collections, SQL relational databases, ADO.NET Datasets, XML documents, etc. In Visual Studio 2008, Visual C# and Visual Basic are the languages that implement the LINQ language extensions. LINQ language extensions use the new standard query operators API, which is the query language for any collection that implements IEnumerable

This book gets readers started with LINQ and shows how it will make their programming life easier by making use of new features from the .NET Framework 3.0. The book is split into seven chapters, each of which is dedicated to presenting a feature of LINQ and its usage in real-life scenarios. It introduces the reader to the basic concepts of LINQ, and takes them through using LINQ with an example-driven approach.

This book is for .NET developers who want to find out exactly what LINQ is, what it can do for them, and how to program with LINQ. The book is published by Packt and is available now. For more information about this book, please visit http://www.packtpub.com/linq-quick-starter/book

Wednesday, October 31, 2007

Writing If Statements and Boolean Tests in C#


In this video tutorial, learn how to write if, else, and else if statements in C#.

Sunday, September 30, 2007

Codejock Software Introduces Xtreme ToolkitPro and SuitePro 2007 Vol. 2 for Visual Studio .NET

Codejock Software a leading provider of cutting-edge user interface components, today has announced the release of Xtreme Toolkit Pro and Xtreme Suite Pro 2007 Volume 2 for Visual Studio .NET®, providing a comprehensive set of fully customizable user interface components for use with Visual C++ MFC, ActiveX COM and Microsoft.NET development platforms. This release incorporates many new enhancements to the already full featured Codejock product line including:

  • New Vista Style Task Dialog Control for ActiveX: A Windows Vista style Task Dialog control is now included with the SuitePro.
  • Xtreme Controls for ActiveX: ActiveX now includes a Vista style Task Dialog, TreeView, ListView, Hex Edit, Progress Bar, Scroll Bar, Tray Icon, Web Browser, Tip of the Day Dialog, Browse Folder Dialog, Window List Dialog, Masked Edit, Slider and Month Calendar controls.
  • Office 2007 Style HTML Super Tips: HTML tooltips allow valid snippets of HTML to be used to format tip windows.
  • Outlook 2007 Style Calendar Appointment Categories: Categories replace the old appointment labels and there can be several categories set to any appointment.
  • Excel Style Header and Footer Rows: Header and footer rows allows rows in the report to always remain visible at the top and bottom of the report.
  • Multiple In-place Property Grid Buttons: Each property grid item can have several buttons associated to make it easier for users to select data for the item.
  • Tabbed List and Tree View: Tabbed list and Tree view controls have the same functionality as a tab control, only they use an alternative method of navigation.

A great alternative to creating a series of confusing and difficult to understand dialog boxes with the MessageBox API would be to use a Vista Style Task Dialog. With a task dialog all the information a user needs to make an informed decision can be presented to them in an easy to understand and concise format. The design of the task dialog looks better and is much simpler, which improves usability by stating the purpose, providing self-explanatory responses, enabling expandable content for added instructions and rich text support to better layout information.

Xtreme Controls is now available for ActiveX as well as included with Xtreme Suite. ActiveX now includes a Vista style Task Dialog, Tree View, List View, Hex Edit, Progress Bar, Scroll Bar, Tray Icon, Web Browser, Tip of the Day Dialog, Browse Folder Dialog, Window List Dialog, Masked Edit, Slider and Month Calendar control. This comprehensive set of components has been designed to handle most any GUI application development requirement.

Office 2007 style HTML Super Tips allow HTML code snippets to be used to format the tip window. HTML features such as tables, font, color, image and many more can be used to create just about any style of tip needed.

Outlook 2007 style calendar appointment categories are what replaced the old label system. There can be several categories set to any appointment at the same time. Categories make it easy to organize appointments and see what category they belong to by assigning a color to the appointment.

Each property grid item can now have several buttons associated to make it easier for users to select data for the item. For example there might be a button for a drop-down list of image file names and another button to allow a browse folder dialog to open an image file not in the list.

Tabbed list and Tree view controls are just a fancy version of a tab control giving an alternative method of navigation. These use controls that users are already familiar with and put them to use navigating property sheets. The property sheets fully support the SkinFramework.

A complete list of all new features can be found in the release notes for each product, found on the company's website, www.codejock.com.

About Codejock Software

Codejock Software, a division of Codejock Technologies, LLC based in MORRICE, Michigan provides reusable software components that facilitate rapid user interface development using Microsoft® Visual Studio .NET® development platforms. Codejock Software is committed to helping developers realize their goals with cutting-edge components, superior customer service and technical support. Codejock Software's products and evaluation versions are available for download on the company's website, for more information visit www.codejock.com.

Source: PRWeb

Monday, August 20, 2007

Learn SQL Server 2005 with AppDev's Newest Release

AppDev recently released the SQL Server™ 2005 Power Suite for developers using or learning Visual Basic 2005 or Visual C# 2005. A major upgrade from its very successful predecessor, SQL Server™ 2000, SQL Server™ 2005 includes numerous new features and functionalities. By utilizing the AppDev SQL Server™ 2005 Power Suite developers can learn how to take advantage of these improvements and increase productivity and performance.

The SQL Server™ 2005 Power Suite includes seven courses on 66 CD’s or eight DVDs. It is also available on AppDev’s latest learning solution, KSource Online Learning™. The SQL Server™ 2005 Power Suite begins with AppDev’s exploring series for an overview of the new features and functionality of SQL Server™ and moves onto more in-depth discussion of topics including Business Intelligence, BizTalk Server and ADO.NET.

Each course is led and written by some of the most recognized names in the industry and most include hands-on labs, sample code, printable courseware, and pre/post exams.

“The AppDev SQL Server™ 2005 Power Suite is an excellent way to get up to speed with the over five years of Microsoft SQL Server™ enhancements,” AppDev President and CEO Craig Jensen said. “AppDev’s easy to follow instruction and award-winning content ensures that developers will be able to capitalize on all these SQL improvements.

AppDev is an award-winning technical learning company providing in-depth, real-world content in multiple formats. AppDev offers 80+ titles for today's latest technologies including Microsoft® SQL Server™ 2005, Business Intelligence, ASP.NET 2.0, Visual Basic® 2005, Visual C#® 2005 and more. For more information on the AppDev training or for additional training and reference resources, contact AppDev at (800)578-2062 or http://www.appdev.com.

Source: PRWeb

Wednesday, June 20, 2007

New Converters Reduce the Pain of Converting C++ Code

Tangible Software Solutions Inc. announced today the release of C++ to C# Converter version 1.0 and C++ to VB Converter 1.0. C++ to C# Converter and C++ to VB Converter translate C, C++, Managed C++ (VC++ 2003), and C++/CLI (VC++ 2005) source code to C# and VB at the file and code snippet levels.

"C++ is such a complex language compared to C# and VB that most developers have assumed that any useful degree of automated conversion was impossible," says Dave Doknjas, president of Tangible Software Solutions. “Although these two new tools provide just the first step in migrating C++ to C# or VB, it produces a high quality result which can then be brought to production quality C# or VB code with less effort than recoding everything from scratch.”

C++ to C# Converter and C++ to VB Converter also offer customization features to allow users to specify their own C++ library function call replacements. "C++ to C# Converter and C++ to VB Converter are primarily syntax converters, replacing only the most obvious C and C++ function calls that have direct .NET equivalents, but we also allow you to specify your own replacements for C++ function calls. This minimizes the number of adjustments required in the converted code," says Doknjas. “You can specify the replacement of function calls with static or instance method calls where one of the original arguments becomes the instance variable.” Other options include general custom string replacements, placement of braces and indentation options.

Both C++ to C# Converter and C++ to VB Converter retail at US$99 per user and include help documentation and free updates and technical support for one year. The demo editions of C++ to C# Converter and C++ to VB Converter are available at: http://www.tangiblesoftwaresolutions.com/Demo.htm

About Tangible Software Solutions Inc.
Founded in 1997, Tangible Software Solutions Inc. is a software development and consulting firm specializing in .NET language tools that convert between VB, C#, C++, and Python. The company’s catalog also features such programs like Instant C#, Instant VB, Instant C++, Instant Python, and Clear VB. For more information on Tangible Software Solutions Inc., visit the company's web site at: http://www.tangiblesoftwaresolutions.com

Product web site: http://www.tangiblesoftwaresolutions.com
Product page: http://www.tangiblesoftwaresolutions.com/Product_Details/Products.htm
Direct demo download link: http://www.tangiblesoftwaresolutions.com/Demo.htm

Source: PRWeb

Thursday, May 24, 2007

9Rays.Net Announces the Release of Spices.Fortress

Development of a commercial application never stops when the last line of code has been written. Delivering the product to potential clients is highly important as well. Most programs are distributed as trial or evaluation versions. Nonetheless, weak and vulnerable protection mechanisms may jeopardize the security of your source code and enable competitors or hackers get access to the full functionality of your application, thus stultifying your efforts and time invested into development. The choice of the right protection tool that will satisfy your specific needs may be anything but easy. If you are looking for a rock-stable, reliable and elegant code protection solution, make sure not to miss "Spices.Fortress".

Spices.Fortress for C# 2.0 is a protection tool (not an obfuscator) for C# 2.0 applications.The goal of Spices.Fortress is to protect C# applications from unauthorized use by limiting the functionality of evaluation or trial versions. Applications protected by Spices.Fortress work as evaluation versions, but as soon as they are unlocked with a secure Fortress Key, they start operating as fully functional versions. It should be noted that Spices.Fortress does not protect .NET class libraries, but .NET Windows Forms applications only.

  • protection of .NET applications, not their obfuscation
  • protection of the data needed to run the application, not the code itself
  • use of only native (but characteristic of C#) means
  • the protected executable is natively compiled by C# (hence no compatibility problems)
  • no external processing of C#-produced protected executables
  • the Key is not checked but is used to restore the protected functionality
  • each Key contains personal data, therefore each Key may be easily identified.

Overview
Spices.Fortress does not in any way obfuscate, but protects .NET applications.

When protecting applications, Spices.Fortress uses only native C# means, i.e. no external processing of C#-produced executables takes place. It is important that it is not the code, but the data needed to run the application is protected. In .NET Windows Forms applications data is a link between events and event handlers. The difference between the trial and the registered versions is based on the use of different event handlers for trial and registered versions of the protected application. The trial version uses one set of event handlers, whereas the registered version uses another one.

Spices.Fortress protects the forms of C# projects on the source level, which means that Spices.Fortress temporarily modifies the source code and then, after recompilation, the application is protected.

When applied, Spices.Fortress modifies the source code of the form in such a manner that after re-compiling each event protected by Spices.Fortress has no event handler assigned. When a protected application is started, the trial event handlers are assigned to corresponding events. If a valid Fortress Key is found, registered event handlers replace the trial ones. The protected application does not use any checking routines to choose which set of event handlers to use. Instead, it uses the data contained in the Fortress Resource and the Fortress Key to assign registered event handlers to corresponding events. To be protected by Spices.Fortress, a C# form must contain components that have events with assigned event handlers.The personal data stored in each Fortress Key allows to easily identify each valid Fortress Key.

In a nutshell, Spices.Fortress is an elegant, intuitive and affordable solution for developers seeking a better way to protect their products from unwanted intrusion and willing to have a simple, yet efficient mechanism of limiting the functionality of trial and evaluation versions of their software.

Future versions of Spices.Fortress will also support VB.NET projects.

Pricing and Availability
Spices.Fortress supports Microsoft Windows 2000, Microsoft Windows XP, Microsoft Windows Server 2003 and Microsoft Windows Vista and costs $292.95. Further information on Spices.Fortress, FAQ's, as well as its free downloadable trial version is available from: http://www.9rays.net/products/Spices.Fortress/

About 9Rays.Net
9Rays.Net consists of several groups of developers working together on several lines of products and committed to 100% customer satisfaction and top product quality. Established in 2001, the company specializes in developing applications and tools for individuals, small and medium businesses using Microsoft .NET, Borland Delphi, C++ Builder, ActiveX and a number of related technologies. Since its foundation, 9Rays.Net has been working on improving its main products, providing technical support to customers that have chosen 9Rays.Net products, and developing new trends in the area of creating stable, reliable and truly efficient applications for a wide range of popular platforms.

Source: PRWeb

Saturday, May 19, 2007

Convert an Excel Chart to Image

Introduction
Charts are visually appealing and make it easy for users to see comparisons, patterns, and trends in data. For instance, rather than having to analyze several columns of worksheet numbers, you can see at a glance whether sales are falling or rising over quarterly periods, or how the actual sales compare to the projected sales.

Sometimes, you do need to present the chart in your applications or web pages. You might need to insert it into a Word Document, a PDF file, a Power Point Presentation or in some other scenario. Simply you want the chart should be rendered as an image, so that you may paste it into your applications with ease. A Picture is worthwhile. Frequently, in the course of work, one has to present statistical and graphical information in an easy to understand and an easy to maintain manner.

You might try Office Automation but Office automation has its own drawbacks. There are several reasons and issues involved: e.g., Security, Stability, Scalability/Speed, Price, Features etc. In Short, there are many reasons, with the top one being that Microsoft themselves strongly recommends against Office automation from software solutions.

There is another option which you can use to convert an Excel Chart to an image using Aspose.Cells. This is a brand new feature offered by Aspose.Cells which is more advanced and of the essence from many of its Features List. In this article, we create some console applications in Visual Studio.Net, that will convert the Excel Charts to render the image files with a few and simplest lines of code using Aspose.Cells API. The conversion is performed with precision and accuracy.

Aspose.Cells: The Real Product
I would take this opportunity to introduce the product to you. Aspose.Cells is an Excel® spreadsheet reporting component that enables you to read and write Excel® spreadsheets without utilizing Microsoft Excel® installed either on the client or server side. Aspose.Cells is a very feature rich component that offers much more than just basic exporting of data. With Aspose.Cells developers can export data, format spreadsheets in every detail and at every level, import images, import charts, create charts, manipulate charts, stream Excel® data, save in various formats including XLS, CSV, SpreadsheetML, TabDelimited, TXT, XML (Aspose.Pdf integrated) and many more. All the Aspose components are totally independent and are not affiliated with, nor authorized, sponsored by Microsoft Corporation. To know more about the product information, features and for a programmer’s guide, check Aspose.Cells Decumentation and online featured demos. You may download its evaluation version for free.

Performing the Task
For demonstration, I choose some common tasks here. I have created two charts (a pie chart and a column chart) in MS Excel and covert these charts to image files using the simplest API of Aspose.Cells with a few lines of code. For conversion we shall create two console applications.

Following is the task list:

  • Converting a Pie Chart to an Image File.
  • Converting a Column Chart to an Image File.
Converting a Pie Chart to an Image File

First we create a pie chart in MS Excel and next we convert the chart to an image file.

Creating a Pie Chart in MS Excel
I opened a new workbook in MS Excel and input some sales data of the different regions into a worksheet. I, then, created a pie chart based on the data and save the excel file. Following is the screenshot of the file created in MS Excel:



Converting Chart to Image
Now I convert the chart to an image file.

Download and Install Aspose.Cells
First, you need to download Aspose.Cells for .Net. Install it on your development computer. All Aspose components, when installed, work in evaluation mode. The evaluation mode has no time limit and it only injects watermarks into produced documents.

Create a Project
Start Visual Studio. Net and create a new console application. This example will show a C# console application, but you can use VB.NET too.

Add References
This project will use Aspose.Cells. So, you have to add reference to Aspose.Cells component in your project. E.g., add a reference to ….\Program Files\Aspose\Aspose.Cells\Bin\Net1.0\Aspose.Cells.dll



Code Snippet
Following is the actual code (Written in C#) used by the component to accomplish the task. You may see that very few lines of code are used to accomplish the task.
//Create a new workbook.
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
//Open the existing excel file which contains the pie chart.
workbook.Open("d:\\piechart.xls");
//Get the designer chart (first chart) in the first worksheet.
//of the workbook.
Chart chart = workbook.Worksheets[0].Charts[0];
//Convert the chart to an image file.
System.Drawing.Bitmap bitmap = chart.ToImage();
//Save the chart image (jpg) file to disk.
bitmap.Save(@"d:\PieChart.jpg",System.Drawing.Imaging.ImageFormat.Jpeg);

Additionally I write its parallel VB.Net code here for your convenience:
'Create a new workbook.
Dim workbook As Aspose.Cells.Workbook = New Aspose.Cells.Workbook()
'Open the existing excel file which contains the pie chart.
workbook.Open("d:\piechart.xls");
'Get the designer chart (first chart) in the first worksheet.
'of the workbook.
Dim chart As Chart = workbook.Worksheets(0).Charts(0)
'Convert the chart to an image file.
Dim bitmap As System.Drawing.Bitmap = chart.ToImage()
'Save the chart image (jpg) file to disk.
bitmap.Save("d:\PieChart.jpg",System.Drawing.Imaging.ImageFormat.Jpeg)

After executing the above code, a jpg file is created based on the pie chart in the template excel file. Here is the screenshot of the output file:



Converting a Column Chart to an Image File

First we create a column chart in MS Excel and next we convert the chart to an image file as we did it before.

Creating a Column Chart in MS Excel
I opened a new workbook in MS Excel and input some marketing costs of the different regions into a worksheet. I, then, created a column chart based on the data and save the excel file. Following is the screenshot of the file created in MS Excel:




Converting Chart to Image
Now I convert the chart to an image file. I‘ll skip the conventional steps here like creating a new project in Visual Studio.Net or adding reference to Aspose.Cells.dll file. I already did it in the first task. I only write here the actual code with presentation of the output image file.

Code Snippet

Following is the actual code (Written in C#) used by the component to accomplish the task. The code is similar to the previous one:
//Create a new workbook.
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
//Open the existing excel file which contains the column chart.
workbook.Open("d:\\columnchart.xls");
//Get the designer chart (first chart) in the first worksheet.
//of the workbook.

Chart chart = workbook.Worksheets[0].Charts[0];
//Convert the chart to an image file.
System.Drawing.Bitmap bitmap = chart.ToImage();
//Save the chart image (jpg) file to disk.
bitmap.Save(@"d:\ColumnChart.jpg",System.Drawing.Imaging.ImageFormat.Jpeg);

Additionally I write its parallel VB.Net code here for your convenience:
'Create a new workbook.
Dim workbook As Aspose.Cells.Workbook = New Aspose.Cells.Workbook()
'Open the existing excel file which contains the column chart.
workbook.Open("d:\columnchart.xls");
'Get the designer chart (first chart) in the first worksheet.
'of the workbook.

Dim chart As Chart = workbook.Worksheets(0).Charts(0)
'Convert the chart to an image file.
Dim bitmap As System.Drawing.Bitmap = chart.ToImage()
'Save the chart image (jpg) file to disk.
bitmap.Save("d:\ColumnChart.jpg",System.Drawing.Imaging.ImageFormat.Jpeg)

After executing the above code, a jpg file is created based on the column chart in the template excel file. Here is the screenshot of the output file:



Summary
In this article I have presented how can we convert an excel chart to render an image file using Aspose.Cells component. Hopefully, it will give you some insight, and you will be able to utilize it some scenarios. Since the Chart2Image feature was really demanding and required by some of Aspose customers. And this is the result of some workout by Aspose.Cells Product Team. The feature is still young, so there might be some precision and accuracy issues occurred in some cases. We are working to enhance the conversion to make it more elegant and sophisticated and will mend any deficiency if found to strengthen it more.

Aspose.Cells can offer more flexibility than others for solutions and provides outstanding speed, efficiency and reliability to meet specific business application requirements. The results do show that Aspose.Cells has benefited from years of research, design and careful tuning.

We heartily welcome your queries, comments and suggestions at Aspose.Cells Forum. We warranty a prompt reply within minutes or hours, Thank you!

Monday, March 12, 2007

Free AppDev Training CD-ROMs

See AppDev quality for yourself -- get a free training CD-ROM taken directly from one of our award-winning courses! If you would like your free CD-ROM shipped outside of the U.S., and/or if you would like to order multiple CDs, a shipping and handling fee will apply.

The available topics include:

  • ADO.NET Using Visual Basic 2005
  • ADO.NET Using Visual C# 2005
  • ASP.NET Using C# .NET
  • ASP.NET Using VB.NET
  • ASP.NET Using Visual Basic 2005
  • ASP.NET Using Visual C# 2005
  • Building Web Services Using Visual Basic 2005
  • Exploring BizTalk Server 2006
  • Exploring SharePoint Server 2007
  • Exploring SQL Server 2005
  • Exploring Visual Basic 2005
  • Exploring Visual C# 2005
  • J2SE 5.0: Java Fundamentals
  • J2SE 5.0: Java Web Development
  • Learning to Program in C# 2005
  • Learning to Program in VB 2005
  • SQL Server 2000
  • SQL Server 2005 Analysis Services
  • SQL Server 2005 Reporting Services
  • SQL Server 2005
  • Visual Basic .NET
  • Visual Basic 2005: Dev. Apps
  • Visual C# .NET
  • Visual C# 2005: Dev. Apps
  • Visual Studio 2005 Tools for Office
  • Windows Server 2003

Get your free CD-ROM or download now!

Thursday, March 8, 2007

Elegant Ribbon v.1.1 for .NET Developers Released

March 8, 2007 -- FOSS Software, an industry leader in developing graphical user interface components for desktop Windows applications, announced the release of version 1.1 of Elegant Ribbon, a set of .NET Windows Forms controls that allow developers to quickly and easily provide their applications with a new-generation user interface (UI) like that introduced in Microsoft Office 2007. Elegant Ribbon is written 100% managed C# and is CLS compliant.

The new version introduces a number of common controls: a combo box, an up-down control, a panel, horizontal and vertical scroll bars, and a label.

Of the distinguished features of Elegant Ribbon is its context-based architecture, where logic and appearance of a control depends on its context in a way that when the parent window changes, the control's look and behavior change too. For example, in design mode the developer can drag-and-drop a control from the ribbon to a form and back because in both cases the control is represented by the very same class. This approach does not restrict the developer in terms of polymorphism and conceptually more elegant than when different contexts require using different classes.

Right now, the company is offering Elegant Ribbon at a 50% discount.

A free fully functional evaluation version is available at http://www.prof-uis.com/download.aspx#ElegantRibbon.

FOSS Software has been successfully developing and offering software solutions and GUI libraries since 2000.

Source: PRWeb

Tuesday, February 13, 2007

Chart ModelKit 2.3 is Released: New Ways of Data Visualization are Available

Barnaul, Altay - February 13, 2007 -- The Chart ModelKit is the first charting solution with the true WYSIWYG designer. The designer has an intuitive interface and allows fast creation of a required chart by selecting its elements (axis, legends, labels, etc) and dragging and dropping them.

The delivery package contains a library of predesigned charts: bar, line, spline, candlestick, pie, stepline, bubble, points, stock. A new version provides new means for data visualization. Now you can display values in the chart as thermometers, tanks and levels.

The well-designed architecture of the product allows the development of chart configurations that are difficult or impossible to create using other approaches. You can use multiple chart elements (axis, areas, series, ticks, labels, etc.) in a single chart, so it is possible to design charts that address specific needs.

The advanced data binding model provides a unique set of capabilities for constructing charts without the need to code. All modifications can be done visually in the designer. With just a few mouse clicks you will get a professionally-looking chart that can be easily integrated into your Windows Forms application.

The Chart ModelKit is also included in the .Net Dashboard Suite, which is a suite of graphical components, intended for the creation of digital dashboards, KPIs and other data visualization applications. The package contains an advanced DashBoardViewer component that allows the simultaneous use of charts and gauges in a single element. By obtaining this product you get the unique means for data visualization. You will be able to represent incoming data not only as usual bar or line charts, but also as gauges or by assigning their interactive behavior make them react to alarming data or alert when the data exceeds defined ranges.

The Chart ModelKit is 100% C# component and it is fully compatible with the .Net Framework 1.1 / 2.0. All .Net data sources are supported. It is possible to use multiple data sources in a single chart.

Runtime of the product is royalty-free, so you can distribute the Chart ModelKit components within your application without any additional fees.

Use cutting-edge data visualization means to make your application more professional.

For more information on the product please visit the product page: http://www.perpetuumsoft.com/Product.aspx?lang=en&pid=42&prw=cmk23

About Perpetuum Software
Perpetuum Software specializes in development of high-quality .NET and ASP.NET software components compatible with MS Visual Studio .NET, C# Builder, Delphi .NET and other IDEs supporting .NET Framework. Such use-proven components as Report Sharp-Shooter, Instrumentation ModelKit, OLAP ModelKit, Chart ModelKit and other .NET components by Perpetuum Software are already well known on the software development market and are used by developers in more than 50 countries.

Source: PRWeb

Monday, January 29, 2007

Create Digital Dashboards with the New .NET Dashboard Suite

January 29, 2007 -- Perpetuum Software LLC announces the release of a pack of fully compatible .NET components designed for the creation of digital dashboards and other data monitoring applications: .NET Dashboard Suite.

The .NET Dashboard Suite includes two powerful components: Instrumentation ModelKit and Chart ModelKit.

The main advantage of this package is ample capabilities for general and specific data visualization. The Instrumentation ModelKit library contains 80+ ready made gauges for displaying and monitoring industrial, financial, and other real-time processes. The Chart ModelKit allows presentation of numeric and text information in the form of 2D graphs and diagrams. A rich library of standard elements and series types facilitates the development process. If necessary, you can create graphs or gauges from scratch. Identical designers allow the creation of visual elements with a unique appearance and functionality or to get access to the element properties and interactively change them with only a few mouse clicks. The .NET Dashboard Suite architecture makes it possible to assign complex interactive behavior to elements without coding. Intuitive interface make components user-friendly.

The .NET Dashboard Suite is developed for .NET, written in C# and contains only managed code. All components are fully compatible with each other. Similar customization facilities, common data management and appearance customization methods allow easy and quick creation of realistic digital dashboards and other real-time monitoring applications.

.NET Dashboard Suite gives you the opportunity to represent general and specific information in the form of simple and easy-to-understand graphical elements. Now with the release of .NET Dashboard Suite it is possible to design complicated and intelligent digital dashboards and KPI's.

For more information please visit:http://www.perpetuumsoft.com/Product.aspx?lang=en&pid=44&prw=dashboard

About Perpetuum Software
Perpetuum Software specializes in development of high-quality .NET and ASP.NET software components compatible with MS Visual Studio .NET, C# Builder, Delphi .NET and other IDEs supporting .NET Framework. Such use-proven components as Report Sharp-Shooter, Instrumentation ModelKit, OLAP ModelKit, Chart ModelKit and other .NET components by Perpetuum Software are already well known on the software development market and are used by developers in more than 50 countries.

Source: PRWeb