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

Free Support Forum - aspose.com

MsoDrawingType Unknown?

hi
for some reason when I add a rectangle shape to a 2007 xlsm file
when I go over all the shapes in the sheet

Shapes shapes = sheet.Shapes;
foreach (Shape shape in shapes)

when I get to the rectangle which I added
the MsoDrawingType of it is unknown instead of MsoDrawingType.Rectangle
any idea what should I do?
thanks

Hi Tsahi,

We are unable to reproduce the issue mentioned by you. We have used the following code snippet. Please forward us the sample XLSM file which contains the issue. We will perform testing on it and will update you about the findings.

Code snippet:

string sFilePath = @"C:\excelTrash\RectangleTest.xlsm";
Workbook workbook = new Workbook(sFilePath);
Aspose.Cells.Drawing.ShapeCollection objShapeColl = workbook.Worksheets[0].Shapes;
foreach (Aspose.Cells.Drawing.Shape objShape in objShapeColl)
{
MessageBox.Show(objShape.MsoDrawingType.ToString() + " :: " + objShape.Name);
}

Thanks,

hi Salman

i've attached the file for the 2 problems I have ( I saw you responsed the the other thread also)

this is how I save the file

workBook.Save(fileName, FileFormatType.Excel2007Xlsm, SaveType.OpenInExcel, httpResponse);

Thnks

Hi,

Please try the attached latest version v5.1.3.1, I have tested and it works fine with it.

Thank you.

Hi Amjad
first of all, the new version solved my problems, so thanks for that.
but I have another issue (only when opening from the open/save dialog box)
when I click on my macro I get the message that ‘File in use’ and I have the options to open it as read only or notify.
when I click on read only I get the message
"cannot run the macro “c:\document and settings…\temporary internet files\content.ie5…\my macro name”. the macro may not be available in this workbook or all macros may be disabled"
any idea why I’m getting this?


Hi,

For your other issue, please create a sample application ( with template file(s)), zip it and post it here to show the issue, we will check it soon.

Thank you.

you can use the template I attached above
the code is:

excelTemplatePath = “~/Resources/Templates/test.xlsm”;
FileStream fileStream;
Workbook workbook;
string fileName2 = string.Format(“file_{0}.xlsm”, Convert.ToString((new Random()).Next(1000000)));
using (fileStream = new FileStream(context.Server.MapPath(excelTemplatePath), FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
{

//Instantiate LoadOptions specified by the LoadFormat.
LoadOptions loadOptions = new LoadOptions(LoadFormat.Auto);

//Create a Workbook object and opening the file from its path
workbook = new Workbook(fileStream, loadOptions);
}


workbook.Save(fileName2, FileFormatType.Excel2007Xlsm, SaveType.OpenInExcel, context.Response);

Hi,

I have logged your issue into our issue tracking system with an id: CELLSNET-20328. Please send us your output<span style=“font-size: 10pt; font-family: “Verdana”,“sans-serif”;”> XLSM file which contains the issue. We
will perform testing on it and will check it soon.

Thank you.

I've attached the file.

Thanks

Hi Tsahi,

Please use the following code. This will help you.

string infn = path + @"test.xlsm";
string outfn = path + @"test_out.xlsm";
FileStream fileStream;
Workbook workbook;
using (fileStream = new FileStream(infn, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
{
//Instantiate LoadOptions specified by the LoadFormat.
LoadOptions loadOptions = new LoadOptions(LoadFormat.Auto);
//Create a Workbook object and opening the file from its path
workbook = new Workbook(fileStream, loadOptions);
}
workbook.Save(outfn, SaveFormat.Xlsm);

Thanks,

Hi Salman

Thanks for your help.

your suggestion is not good for me (even though it works)

because I need to send the file through the response.

I want to do something like this:

workbook.Save(context.Response, fileName, ContentDisposition.Attachment, new OoxmlSaveOptions(SaveFormat.Xlsm));

as I said before the problem ("File in use") is only when opening the file before saving it first

any idea?

Thanks

Hi Tsahi,

We have tested the following code by using Aspose.Cells.v5.1.3.1. It all worked fine. For your considration the output file is attached.

Code snippet:
string infn = path + @"test.xlsm";
string outfn = path + @"test_out.xlsm";
FileStream fileStream;
Workbook workbook;
using (fileStream = new FileStream(infn, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
{
//Instantiate LoadOptions specified by the LoadFormat.
LoadOptions loadOptions = new LoadOptions(LoadFormat.Auto);
//Create a Workbook object and opening the file from its path
workbook = new Workbook(fileStream, loadOptions);
}
workbook.Save(outfn, SaveFormat.Xlsm);

Thanks,

Hi

did you test it also by saving it to the stream using the following save function

and opening it without saving it first ?

workbook.Save(context.Response, fileName, ContentDisposition.Attachment, new OoxmlSaveOptions(SaveFormat.Xlsm));

Thanks

Hi Tsahi,

We are still unable to reproduce the issue. A sample application and a XLSM are attached. Please use v5.1.3.1 to run this application.

Thanks,

hi Salman

I was also able to reproduce it using your program (see attached gif).

all I did was changing the path file to the file I attached (test.xlsm)

could there be some configuration in excel which does this ?

what is the difference between using the macro on a file which was saved and file which wasn't ?

Thanks

Salman,

were you able to reproduce it?

Thanks

hi Salman
I believe I narrowed the problem
it happens only if Internet Explorer is set as the default browser ( I have i.e 8)
can you please try with the file I attached previously ?
Thanks

<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Hi,

Please use the following code to check if it works fine.

Sample code:

string infn = path + @"CELLSNET-20328\test.xlsm";

string fileName = string.Format("file_{0}.xlsm", Convert.ToString((new Random()).Next(1000000)));

HttpContext context = HttpContext.Current;

FileStream fileStream;

Workbook workbook;

using (fileStream = new FileStream(infn, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))

{

//Instantiate LoadOptions specified by the LoadFormat.

LoadOptions loadOptions = new LoadOptions(LoadFormat.Auto);

//Create a Workbook object and opening the file from its path

workbook = new Workbook(fileStream, loadOptions);

}

//workbook.Save(context.Response, fileName, ContentDisposition.Attachment, new OoxmlSaveOptions(SaveFormat.Xlsm));

workbook.Save(context.Response, fileName, ContentDisposition.Inline, new OoxmlSaveOptions(SaveFormat.Xlsm));

context.Response.End();

Thank you