ByteScout Barcode Suite - C# - Merge two documents with spreadsheet sdk - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Barcode Suite – C# – Merge two documents with spreadsheet sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Suite – C# – Merge two documents with spreadsheet sdk

How to merge two documents with spreadsheet sdk in C# with ByteScout Barcode Suite

If you want to learn more then this tutorial will show how to merge two documents with spreadsheet sdk in C#

We made thousands of pre-made source code pieces for easy implementation in your own programming projects. ByteScout Barcode Suite is the bundle that privides 3 SDK products to generate barcodes (Barcode SDK), read barcodes (Barcode Reaer SDK) and read and write spreadsheets (Spreadsheet SDK). It can merge two documents with spreadsheet sdk in C#.

The SDK samples given below describe how to quickly make your application do merge two documents with spreadsheet sdk in C# with the help of ByteScout Barcode Suite. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! If you want to use these C# sample examples in one or many applications then they can be used easily.

Our website gives trial version of ByteScout Barcode Suite for free. It also includes documentation and source code samples.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using System; using System.Collections.Generic; using System.Text; using Bytescout.Spreadsheet; using System.Diagnostics; using System.IO; namespace Sample { class Program { static void Main(string[] args) { // Open existing Spreadsheets Spreadsheet document1 = new Spreadsheet(); document1.LoadFromFile("workbook1.xls"); Spreadsheet document2 = new Spreadsheet(); document2.LoadFromFile("workbook2.xls"); // Create output document Spreadsheet document3 = new Spreadsheet(); // Add new worksheet document3.Workbook.Worksheets.Add(); // Target row int targetRow = 0; // Copy cells from first document for (int i = 0; i < 10; i++) { for (int j = 0; j < 12; j++) { document3.Worksheet(0).Cell(targetRow, j).Value = document1.Worksheet(0).Cell(i, j).Value; } targetRow++; } // Copy cells from second document for (int i = 0; i < 10; i++) { for (int j = 0; j < 12; j++) { document3.Worksheet(0).Cell(targetRow, j).Value = document2.Worksheet(0).Cell(i, j).Value; } targetRow++; } // delete output file if exists already if (File.Exists("Output.xls")){ File.Delete("Output.xls"); } // Save document document3.SaveAs("output.xls"); // Close document document3.Close(); // Open document in default xls viewer Process.Start("Output.xls"); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next