I Have One document .Using below snippest I want to add my web extension taskpane to it so whenver I open that document again then document open with my web extension taskpane.
but when I open that document after run this snippest
my task pane stuck on loading screen.
Here is my code:
static void Main(string[] args)
{
byte[] bytesectionData = File.ReadAllBytes(@"data.docx");
using (MemoryStream ms = new MemoryStream(bytesectionData))
{
Aspose.Words.License licWord = new Aspose.Words.License();
string strLicenscePath = "E:\\ConsoleApp\\ADDTaskPaneinOneDrive\\Resource\\Aspose.Words.lic"; //Aspose Word lic path
licWord.SetLicense(strLicenscePath);
Aspose.Words.Document doc = new Aspose.Words.Document(ms);
Aspose.Words.WebExtensions.TaskPane mypane = new Aspose.Words.WebExtensions.TaskPane();
doc.WebExtensionTaskPanes.Clear();
doc.WebExtensionTaskPanes.Add(mypane);
mypane.DockState = TaskPaneDockState.Right;
mypane.IsVisible = true;
mypane.Width = 300;
mypane.IsLocked = true;
mypane.Row = 1;
Aspose.Words.WebExtensions.WebExtension webExtension = mypane.WebExtension;
webExtension.Reference.Id = "";//here I write my webextension ID
webExtension.Reference.Version = "1.0.0.1";
webExtension.Reference.StoreType = Aspose.Words.WebExtensions.WebExtensionStoreType.ExCatalog;
webExtension.Reference.Store = CultureInfo.CurrentCulture.Name;
webExtension.IsFrozen = false;
webExtension.Properties.Add(new Aspose.Words.WebExtensions.WebExtensionProperty("Office.AutoShowTaskpaneWithDocument", "true"));
webExtension.Properties.Add(new Aspose.Words.WebExtensions.WebExtensionProperty("MyScript", "MyScript Math Sample"));
webExtension.Bindings.Add(new Aspose.Words.WebExtensions.WebExtensionBinding("MyScript", Aspose.Words.WebExtensions.WebExtensionBindingType.Text, "104380646"));
using (MemoryStream ms1 = new MemoryStream())
{
doc.Save(ms1, Aspose.Words.SaveFormat.Docx);
ms.Seek(0, 0);
bytesectionData = ms1.ToArray();
}
File.WriteAllBytes(@"NewBytesOutput.docx", bytesectionData);
}
Console.ReadLine();
}