We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Cells for .NET OLE Objects

Hi,

Currently we’re using the version 18.4.0 of Aspose.Cells, and i’d noticed that the olebjects (pptx type) which is already present on our excel worksheet template that we used is not embedded when we generate the report from our application which we add the data on the template(so basically we didn’t change or manipulate the cell range where the oleobject is already placed). So for now, to fix this issue we downgrade the version to 16.11.0 (which is the recent version that we used).

excel worksheet template(with pptx object) using macro vb => fill worksheet service (adds data to excel template) => export service

This is the sample code on how we add values in worksheet:

reportConfigWorksheet.Cells[MinLayerCell].Value = minLayer;
reportConfigWorksheet.Cells[MaxLayerCell].Value = maxLayer;

//fill locale
reportConfigWorksheet.Cells[ReportConfigLocaleCell].Value = LocaleHelper.GetLanguageLocationHyphenString(CultureInfo.CurrentCulture);

reportConfigWorksheet.Cells[ReportConfigCurrencyCell].Value = _applicationSettingService.GetCurrencySymbol().Replace("{0}", “”).Trim();

On the export service we basically add the file to DTO as base64 encoded string:

using (var ms = new MemoryStream())
{
templateWorkbook.Save(ms, SaveFormat.Xlsb);
exportModel.File = ExportHelper.ConvertStreamToBase64String(ms);
}

exportModel.FileName = GetFileName(model.ReportConfiguration.ReportName, Infrastructure.ExcelFileType.Binary);

exportModel.FileType = ExcelBinaryFileType;

Attached object that is already existing on our template that we used to generate a report:

image.png (11.1 KB)

After generating the report:

image.png (16.0 KB)

Could you let us know what is the latest working version of the aspose.cells that is working properly with the embedding of oleobjects and can this be fix on the latest version asap?

Thanks!

Gerald

@geraldg,

Thank you for your query.

I have tried to re-create this problem using following code and own sample file but no success as output file contains OLE object properly.

static void SampleCode()
{
    Workbook templateWorkbook = new Workbook(@"Template.xltx");
    templateWorkbook.Worksheets[0].Cells[0, 0].Value = "Data 1";
    MemoryStream Data = new MemoryStream();
    using (var ms = new MemoryStream())
    {
        templateWorkbook.Save(ms, SaveFormat.Xlsb);
        templateWorkbook.Save(@"output.xlsb", SaveFormat.Xlsb);
        Data = (MemoryStream)ConvertToBase64(ms);
        WriteMemoryStreamToFile(Data, @"Output.bin");
    }

    //exportModel.FileName = GetFileName(model.ReportConfiguration.ReportName, Infrastructure.ExcelFileType.Binary);
    //exportModel.FileType = ExcelBinaryFileType;
}
static private void WriteMemoryStreamToFile(MemoryStream ms, string FileName)
{
    using (FileStream file = new FileStream(FileName, FileMode.Create, System.IO.FileAccess.Write))
    {
        byte[] bytes = new byte[ms.Length];
        ms.Read(bytes, 0, (int)ms.Length);
        file.Write(bytes, 0, bytes.Length);
        ms.Close();
    }
}
static private Stream ConvertToBase64(Stream stream)
{
    Byte[] inArray = new Byte[(int)stream.Length];
    Char[] outArray = new Char[(int)(stream.Length * 1.34)];
    stream.Read(inArray, 0, (int)stream.Length);
    Convert.ToBase64CharArray(inArray, 0, inArray.Length, outArray, 0);
    return new MemoryStream(Encoding.UTF8.GetBytes(outArray));
}

Please share your complete sample console application which we may use to re-create the problem here. Also send us the template file and output files. Please provide the console application which can be compiled and executed for testing without any error.

Hi,

This is the sample console application that you can try(Using version 18.4.0) and the template use is already included:

Thanks!

Gerald

Hi,

This is the sample code with the template, we’re using aspose.cells version 18.4.0:

SampleCodeWithTemplate.zip (1.1 MB)

As you will notice, the object present in excel is not attached when we generate the sample report.

Thanks!

Gerald

@geraldg,

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46213 - OLE Object broken while saving to XLSB

@geraldg

This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-46213”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

Hi,

Thanks for the quick response. Looking forward to your fixed version.

Thanks!

@geraldg,

You are welcome.

@geraldg,

Please try our latest version/fix: Aspose.Cells for .NET v18.6.5:
Aspose.Cells for .NET v18.6.5 (.NET 2.0)
Aspose.Cells for .NET v18.6.5 (.NET 4.0)

Your issue should be fixed in it.

Let us know your feedback.

Hi,

Okay let me try that.

Thanks!

Hi,

This fix the problem thanks again. Can we know when this fix will be available to nuget since our project leverage the used of nuget packages.

Thanks!

@geraldg,

Good to know that your issue is sorted out by the new fix/version.

You may use the fix in productiion as the fixes are fully tested for QA and it is safe to use in the production server. However our next official release, i.e., Aspose.Cells for .NET v18.7 is planned to be released in the third week of July, 2018.

The issues you have found earlier (filed as CELLSNET-46213) have been fixed in Aspose.Cells for .NET v18.7. Please also check the document/article for your reference: https://docs.aspose.com/display/cellsnet/Installation