Reset all paragraph style from another document

Hi to all,
i want to write a macro that reset all the paragraph style in a writer document to a specific format.
The “good” format is stored in a given file, let’s say that this file has a stile “foo” with some property that is child of “bar” style.

I have then another writer file, if this file has no foo and bar style, they get imported as they are from the first document. If they are present but with different properties or parent-child structure, they are forced exactly as the first file.

How can i do that? Any hints?

Why do you want a macro? You can simply import styles using the Stylist with overwrite on.

I did not know te overwrite option… thanks!
anyway there’s a way to call this feature in a lobasic macro?

No idea, sorry. However, I would follow a different way: simply (well, relatively simply) programmatically create styles in an open document.