ByteScout Spreadsheet SDK - C# - Add Images Advanced - ByteScout

ByteScout Spreadsheet SDK – C# – Add Images Advanced

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – C# – Add Images Advanced

How to add images advanced in C# and ByteScout Spreadsheet SDK

How to code in C# to add images advanced with this step-by-step tutorial

The sample source codes on this page shows how to add images advanced in C#. ByteScout Spreadsheet SDK can add images advanced. It can be used from C#. ByteScout Spreadsheet SDK is the SDK that can write and read, modify and calculate Excel and CSV spreadsheets. Most popular formulas are supported. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays.

Fast application programming interfaces of ByteScout Spreadsheet SDK for C# plus the instruction and the code below will help you quickly learn how to add images advanced. In order to implement the functionality, you should copy and paste this code for C# below into your code editor with your app, compile and run your application. Enjoy writing a code with ready-to-use sample C# codes.

ByteScout Spreadsheet SDK free trial version is available on our website. C# and other programming languages are supported.

Try ByteScout Spreadsheet SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Text; using Bytescout.Spreadsheet; using Bytescout.Spreadsheet.MSODrawing; namespace AddImages { class Program { static void Main(string[] args) { // Create spreadsheet Spreadsheet doc = new Spreadsheet(); // Add worksheet Worksheet worksheet = doc.Worksheets.Add(); // Put an image to "C3" cell PictureShape shape = worksheet.Pictures.Add(2, 2, "image1.jpg"); // Make the picture "floating". It will be not moved if you move or resize the "C3" cell shape.PlacementType = Placement.FreeFloating; // Make the picture brighter shape.Brightness = 0.8f; // Put second image to "K11" cell shape = worksheet.Pictures.Add(10, 10, "image2.jpg"); // Make the picture bound to the cell. It will be moved alonf with the "K11" cell shape.PlacementType = Placement.Move; // Crop 10% from left and right side of the image shape.CropFromLeft = 0.1f; shape.CropFromRight = 0.1f; // Delete output file if exists if (File.Exists("output.xls")) { File.Delete("output.xls"); } // Save document doc.SaveAs("output.xls"); // Close spreadsheet doc.Close(); // Open generated XLS document in default application Process.Start("output.xls"); doc.Dispose(); } } }

Try ByteScout Spreadsheet SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)



Get 60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page

Explore ByteScout Spreadsheet SDK Documentation

Get ByteScout Spreadsheet SDK Free Training


Get Your Free API Key

Explore Web API Documentation