Setting the style set

Hi there,
MS Word has predefined style set in the Design tab as in the attached snapshot. When we set the particular style set, we assume the styles.xml got populated according to style set formatting. Now we are adding all styles from one document to another.

We need to change the style set as defined in the sample document but want to retain any custom styles already exists at destination side. We are using the import style methodology currently for adding the styles from one document to another.

But please consider the case where the destination document is having “Fancy” (one of the style set in MS word’s Design tab). The styles.xml got populated accordingly, this changes the styles shading and other characterstics internally.
The source document has default style set and the styles.xml contains minimum basic styles definition (mainly 4).
Now while applying styles from source to destination should override the “Fancy” style set and add the “Default” from destination. But what import style way is doing is not touching any earlier defined definition present in destination’s styles.xml.

So, is there a way to override the style set or to assign the style set in entirety whatever is defined in source document?

thanks.

Adding to the last post on the thread:
As in the snapshot attached with the last post - there is way to “reset to the Default Style Set”. If we can do the same using Aspose that could work for us, I think.

Thanks for looking into this.

Hi Praneeth,


Thanks for your inquiry.
Praneeth:
Hi there,
MS Word has predefined style set in the Design tab as in the attached snapshot. When we set the particular style set, we assume the styles.xml got populated according to style set formatting. Now we are adding all styles from one document to another.

We need to change the style set as defined in the sample document but want to retain any custom styles already exists at destination side. We are using the import style methodology currently for adding the styles from one document to another.

But please consider the case where the destination document is having “Fancy” (one of the style set in MS word’s Design tab). The styles.xml got populated accordingly, this changes the styles shading and other characterstics internally.
The source document has default style set and the styles.xml contains minimum basic styles definition (mainly 4).
Now while applying styles from source to destination should override the “Fancy” style set and add the “Default” from destination. But what import style way is doing is not touching any earlier defined definition present in destination’s styles.xml.

So, is there a way to override the style set or to assign the style set in entirety whatever is defined in source document?

thanks.
This is the expected behavior i.e. if collection already contains a style with the same name, then new name is
automatically generated by adding “_number” suffix starting from 0 e.g.
“Normal_0”, “Heading 1_1” etc. However, we will consider providing an option to override a particular Style in “Style Set” in future. The ID of this issue is WORDSNET-10478. Your request has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for any inconvenience.

Best regards,

Hi Praneeth,

Praneeth:
Adding to the last post on the thread:
As in the snapshot attached with the last post - there is way to “reset to the Default Style Set”. If we can do the same using Aspose that could work for us, I think.

Thanks for looking into this.
I have logged this request as WORDSNET-10479 in our issue tracking system. Our development team will further look into the details of this request and we will keep you updated on the status.

Best regards,

Hi Praneeth,


Thanks for being patient.

Regarding WORDSNET-10478, this can be achieved by renaming style e.g. targetStyle.Name = “Heading 1” for a style that had name of “Heading 1_1”. The rename will override the original Heading 1 with the one that was under _1 name.

Regarding WORDSNET-10479, the same effect can be achieved by using a combination of Style.Remove() and recreation of the same style (by accessing it in the collection by name) for all styles instantiated in the document. This will work nicely for all built-in styles see Style.BuiltIn.

Please let me know if these workarounds are acceptable for you.

Best regards,

Hi Praneeth,


Thanks for being patient.

Regarding WORDSNET-10479, our development team has completed the work on your issue and has come to a conclusion that they won’t be able to implement the fix to your issue. Your issue (WORDSNET-10479) is now closed with ‘Won’t Fix’ resolution.

Regarding WORDSNET-10478, our development team has completed the work on this issue as well and has come to a conclusion that this issue is actually not a bug. So, we have closed this issue as ‘Not a Bug’.

Please see the workarounds mentioned in my previous reply.

Best regards,