package AsposeCellsExamples.TechnicalArticles;

import java.io.FileInputStream;

import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;
import AsposeCellsExamples.Utils;
import java.io.*;

public class SetBackgroundPictureforWorksheet {
	public static void main(String[] args) throws Exception {

		// The path to the documents directory.
		String dataDir = Utils.getSharedDataDir(SetBackgroundPictureforWorksheet.class) + "TechnicalArticles/";
		// Instantiate a new Workbook.
		Workbook workbook = new Workbook();
		// Get the first worksheet.
		Worksheet sheet = workbook.getWorksheets().get(0);

		// Get the image file.
		File file = new File(dataDir + "school.jpg");
		// Get the picture into the streams.
		byte[] imageData = new byte[(int) file.length()];
		FileInputStream fis = new FileInputStream(file);
		fis.read(imageData);

		// Set the background image for the sheet.
		sheet.setBackgroundImage(imageData);

		fis.close();
		// Save the excel file
		workbook.save(dataDir + "SBPforWorksheet.xls");

	}
}

@@ -39,17 +39,19 @@
 rticles;
-%0A
+%0D%0A%0D
 %0Aimport 
@@ -74,17 +74,19 @@
 tStream;
-%0A
+%0D%0A%0D
 %0Aimport 
@@ -111,16 +111,17 @@
 orkbook;
+%0D
 %0Aimport 
@@ -147,16 +147,17 @@
 rksheet;
+%0D
 %0Aimport 
@@ -182,16 +182,17 @@
 s.Utils;
+%0D
 %0Aimport 
@@ -201,17 +201,19 @@
 va.io.*;
-%0A
+%0D%0A%0D
 %0Apublic 
@@ -252,16 +252,17 @@
 ksheet %7B
+%0D
 %0A%09public
@@ -312,17 +312,33 @@
 eption %7B
-%0A
+%0D%0A%09%09// ExStart:1%0D
 %0A%09%09// Th
@@ -355,26 +355,16 @@
 the 
-documents 
 director
 y.%0A%09
@@ -363,10 +363,13 @@
 ctor
-y.
+ies.%0D
 %0A%09%09S
@@ -374,20 +374,22 @@
 %09String 
-data
+source
 Dir = Ut
@@ -396,88 +396,79 @@
 ils.
-getSharedDataDir(SetBackgroundPictureforWorksheet.class) + %22TechnicalArticles/%22;
+Get_SourceDirectory();%0D%0A%09%09String outDir = Utils.Get_OutputDirectory();%0D
 %0A%09%09/
@@ -496,16 +496,17 @@
 orkbook.
+%0D
 %0A%09%09Workb
@@ -535,16 +535,17 @@
 kbook();
+%0D
 %0A%09%09// Ge
@@ -566,16 +566,17 @@
 rksheet.
+%0D
 %0A%09%09Works
@@ -620,17 +620,19 @@
 .get(0);
-%0A
+%0D%0A%0D
 %0A%09%09// Ge
@@ -648,16 +648,17 @@
 ge file.
+%0D
 %0A%09%09File 
@@ -677,32 +677,39 @@
 ile(
-data
+source
 Dir + %22
-school.jp
+background.pn
 g%22);
+%0D
 %0A%09%09/
@@ -743,16 +743,17 @@
 streams.
+%0D
 %0A%09%09byte%5B
@@ -796,16 +796,17 @@
 ngth()%5D;
+%0D
 %0A%09%09FileI
@@ -848,16 +848,17 @@
 m(file);
+%0D
 %0A%09%09fis.r
@@ -872,17 +872,19 @@
 geData);
-%0A
+%0D%0A%0D
 %0A%09%09// Se
@@ -920,16 +920,17 @@
 e sheet.
+%0D
 %0A%09%09sheet
@@ -960,17 +960,19 @@
 geData);
-%0A
+%0D%0A%0D
 %0A%09%09fis.c
@@ -978,16 +978,17 @@
 close();
+%0D
 %0A%09%09// Sa
@@ -1004,16 +1004,17 @@
 cel file
+%0D
 %0A%09%09workb
@@ -1026,12 +1026,11 @@
 ave(
-data
+out
 Dir 
@@ -1055,14 +1055,31 @@
 .xls
+x
 %22);
-%0A
+%0D%0A%09%09// ExEnd:1%0D
 %0A%09%7D
+%0D
 %0A%7D
+%0D
 %0A

Update SetBackgroundPictureforWorksheet.java