Hi All,
I am trying to Deleting MACRO from DOC/DOCX/ODT File using Open office SDK 4.1.3 using C# library, I not able to find any guidance,
can you please provide any pointers regarding.
Thanks,
Sachin S
Deleting MACRO from DOC/DOCX/ODT File
-
- Posts: 4
- Joined: Fri Jul 21, 2017 2:02 pm
Deleting MACRO from DOC/DOCX/ODT File
OpenOffice 4.1.3 Windows 10
Re: Deleting MACRO from DOC/DOCX/ODT File
/Tools/ Options/ Organise Macros, select the language in which the macro was written (try all in turn if not certain), select the macros and press the Delete button on the macro organise window.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
-
- Posts: 4
- Joined: Fri Jul 21, 2017 2:02 pm
Re: Deleting MACRO from DOC/DOCX/ODT File
Thanks RoryOF,
I am trying to do it pragmatically, can you please help.
Thanks
Sachin
I am trying to do it pragmatically, can you please help.
Thanks
Sachin
OpenOffice 4.1.3 Windows 10
Re: Deleting MACRO from DOC/DOCX/ODT File
Code: Select all
libs = ThisComponent.BasicLibraries
for each s in libs.getElementNames()
libs.removeLibrary(s)
next
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 4
- Joined: Fri Jul 21, 2017 2:02 pm
Re: Deleting MACRO from DOC/DOCX/ODT File
Thanks Villeroy,
can please help me to with C# code.
Thanks,
Sachin
can please help me to with C# code.
Thanks,
Sachin
OpenOffice 4.1.3 Windows 10
Re: Deleting MACRO from DOC/DOCX/ODT File
You are the C# developer. I don't even have a Windows machine. You should know how to connect with a running instance of your office suite and get a reference to a document. In my macro code "ThisComponent" refers to the currently active document.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 4
- Joined: Fri Jul 21, 2017 2:02 pm
Re: Deleting MACRO from DOC/DOCX/ODT File
I have checked in code for "Document", it does not have any method "BasicLibraries" in C# assemblies/DLLs. I got, its hard get answers here for C# related queries for OPenOffice SDK.
Thanks for your time.
Thanks for your time.
OpenOffice 4.1.3 Windows 10
Re: Deleting MACRO from DOC/DOCX/ODT File
[Tutorial] Introduction into object inspection with MRI
Install MRI. It produced the following code for me:
object oInitialTarget is the document in question
Install MRI. It produced the following code for me:
Code: Select all
using System;
using unoidl.com.sun.star.beans;
using unoidl.com.sun.star.container;
using unoidl.com.sun.star.lang;
using unoidl.com.sun.star.script;
using unoidl.com.sun.star.uno;
public class Snippet {
public void snippet(XComponentContext xContext, object oInitialTarget)
{
try
{
XPropertySet xPropSet = (XPropertySet)oInitialTarget;
XLibraryContainer xLibraryContainer = (XLibraryContainer) xPropSet.getPropertyValue("BasicLibraries").Value;
XNameAccess xNameAccess = (XNameAccess) xLibraryContainer;
XNameAccess xNameAccess_2 = (XNameAccess) xNameAccess.getByName("Standard").Value;
}
catch (RuntimeException e)
{
// getByName
Console.WriteLine(e.Message);
}
catch (WrappedTargetException e)
{
// getPropertyValue, getByName
Console.WriteLine(e.Message);
}
catch (UnknownPropertyException e)
{
// getPropertyValue
Console.WriteLine(e.Message);
}
catch (NoSuchElementException e)
{
// getByName
Console.WriteLine(e.Message);
}
}
}[
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice