How to getTable in Presentation?

Could I get the current table after using the GetCurrentSlide function in the Presentation API?
I would like to insert data into the current table using Plugins.

Hi @Donglin :wave:
Unfortunately, at the moment, the following methods for the table editor are not implemented:

  • ApiSlide.GetAllTables()
  • ApiLayout.GetAllTables()
  • ApiShape.GetAllTables()

We have added your request for the implementation of these methods.

Thanks for your reply. When is it expected to be implemented?

@Donglin
Unfortunately, there is currently no timeline for implementation.

Is it possible to add a text box to the current slide? I want to add a title to the text box on top of the current slide. I can only insert Table/Shape/Image/Chart to the current slide. Is it right?

@Donglin :wave:

Text box essentially is a shape without fill with text inside. You can simply create a shape using ‘rect’ preset, apply no fill and stroke, then add text content.

Example:
Creating presentation

var oShape = Api.CreateShape('rect', 8056800, 3020400, Api.CreateNoFill(), Api.CreateStroke(0, Api.CreateNoFill()));

For more information, you can refer to the following API documentation:
Shape creation

Fill properties
Stroke properties

Unfortunately, we currently don’t have a method that would directly create a text box without additional settings.
We’ll try to implement this in the future

Thanks a lot for your great help.

1 Like

@Nikolas
I am trying to replace the OleObjects inside a Presentation when using Plugins. I have understood some APIs that can retrieve all Shapes, all Images, all charts, and all OleObjects, allowing me to retrieve a specific OleObject on a particular Slide.

However, since deleting an object can only be done by referencing its position on the Slide, and I cannot determine the position of the OleObject, I am unable to achieve this. Is there a better way to accomplish this?

Hello, @Donglin
If you want to implement it in the plugin, we already have the plugin method EditOleObject available for that.

Or do you still prefer to replace it separately through the builder?

1 Like

Hello, @Nikolas
Thank you for sharing the information. I will use the plugin method that I never tried before.

1 Like

Hello, @Nikolas
I am encountering issues while trying to utilize the EditOleObject API. Could you please advise on what should be set for the objectId?

Below is my code snippet:

Adding Ole Object:

var _param = {
            "data": "no data",
            "imgSrc": "url for image",
            "guid": "asc.{123456}",
            "width": 70,
            "height": 70,
        };
window.Asc.plugin.executeMethod ("AddOleObject", [_param], function() {
            console.log('add _param',_param);
            // window.Asc.plugin.executeCommand ("close", "");
        });

Editing Ole Object:

var _param = {
            "data": "no data",
            "imgSrc":url for image",
            "objectId": "asc.{123456}",
            "width": 70,
            "height": 70,
        };
window.Asc.plugin.executeMethod ("EditOleObject", [_param], function() {
            console.log('update _param',_param);
            // window.Asc.plugin.executeCommand ("close", "");
        });

I also attempted to add data using the builder API:

var oPresentation = Api.GetPresentation();
var oSlide = oPresentation.GetCurrentSlide();
var oOleObject = Api.CreateOleObject("url for image", 19 * 360000, 14.5 * 360000, "Test Message", "asc.{123456}");
oOleObject.SetPosition(1.7 * 360000, 3.3 * 360000);
oSlide.AddObject(oOleObject);

Please let me know if you have any insights on resolving the issue with the EditOleObject API. Thank you.

Hello @Donglin
If you don’t mind, I will step to this thread too.

I am encountering issues while trying to utilize the EditOleObject API. Could you please advise on what should be set for the objectId?

To be honest, I’m not sure that I understood the entire scenario right. The objectId is unique parameter and you can’t change it from a plugin. Therefore, you need to use already persisted objectId of your added Ole Object. You can check objectId of added OleObject through onInsertOleObjects event: DocumentServer/CHANGELOG.md at master · ONLYOFFICE/DocumentServer · GitHub