Hi all,
using the latest Aspose.BarCode components I have generated a bar code image and placed it into the attached excel file.
Using the code below I try to read the image from the excel but I get an exception "Parameter is not valid" (using the same technigue, I'm able to read a value from the same image placed in Word).
Pls. advice what I'm missing, the test Excel file is attached.
Thanks.
Mirek
[Test, Ignore] public void ReadValueFromExcel() { const string documentPathName = @"C:\Temp\ExcelWithBarCodeImage.xls";
var workbook = new Workbook();workbook.Open(documentPathName);
var picture = workbook.Worksheets[0].Pictures[0];
Assert.AreEqual(ImageFormat.Jpeg, picture.ImageFormat);
var memoryStream = new MemoryStream();picture.ToImage(memoryStream, <span style="color: rgb(43, 145, 175);">ImageFormat</span>.Jpeg);
var barCodeText = string.Empty;<span style="color: blue;">try</span> { <span style="color: blue;">var</span> reader = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">BarCodeReader</span>(memoryStream, <span style="color: rgb(43, 145, 175);">BarCodeReadType</span>.DataMatrix); <span style="color: blue;">while</span> (reader.Read()) { barCodeText = reader.GetCodeText(); } } <span style="color: blue;">catch</span> (<span style="color: rgb(43, 145, 175);">Exception</span>) { barCodeText = <span style="color: blue;">string</span>.Empty; }
Assert.IsNotEmpty(barCodeText);
}