Extract group shaped to image and save to local

Hi everyone,

I am reading an Excel worksheet in a .xlsx file which contains a group (1 picture + 1 red rectangle textbox above the picture to highlight a part of picture).

The problem is that I cannot extract this whole group as an image in order to save to local computer.

Noted that, if I used the following block of code, then I can ungroup the original group, and then can be able to extract and save the picture, but the saved picture will loose the red text box drawn on top of the picture:

if (worksheetShapes[i] is IGroupShape groupShape)
{
      foreach (IShape shape in groupShape.Items)
      {
           if (shape is BitmapShapeImpl bitmapShape)
           {   
                 Image image = bitmapShape.Picture;
                 byte[] byteArray = image.ToByeArray();
                 ................
           }
       }
}

Any suggestions?

Many thanks,


4 Replies

KM Kurmitha Manickhaperumal Syncfusion Team February 20, 2024 08:32 AM UTC

Hi,

 

Please refer to the attached sample below for the conversion of worksheet with group shape to Image.


Additionally, refer to this UG for the conversion of worksheet to Image.

https://help.syncfusion.com/file-formats/xlsio/worksheet-to-image-conversion

 

Regards

Kurmitha M.


Attachment: WorksheettoImage_8f05eceb.zip


Ð? Ð?ng replied to Kurmitha Manickhaperumal February 21, 2024 10:01 AM UTC

HiSuggest a reply,


It does not seem to be related to my problem.

I have uploaded my Sample.xlsx file here for you to clearly understand about the issue:

Image_5447_1708420202944

I want to extract the whole picture with red rectangle shape on top of it without the text Text B2 and without white redundant white space on 4 edges of the shape:

Image_7945_1708420181700


Could you please give me some ideas to retrieve this?

Many thanks,


Attachment: Sample_aaa4df70.zip



MM Mugil Murugan Syncfusion Team February 22, 2024 02:41 PM UTC

Hi,

The conversion of group shapes to images is not directly supported; we get the group shape position, and we use the worksheet for image conversion to achieve the group shape to image conversion based on that position.


Please refer to the attached sample below for the conversion of worksheet with group shape to Image.


Regards,
Mugil M.


Attachment: Samples_51eb1c8e.zip


Ð? Ð?ng replied to Mugil Murugan February 23, 2024 08:14 AM UTC

Many thanks for your reply.


Loader.
Up arrow icon