Free Support Forum - aspose.com

MS Excel Theme Fonts Support

Does Aspose Cells support MS Excel Font Themes?

In the MS Excel (and Office) COM API the Font schemes can be accessed by:

Microsoft.Office.Interop.Excel.Workbook workbook = ...

Microsoft.Office.Core.OfficeTheme officeTheme = workbook.Theme

and the Theme Font Scheme by:

officeTheme.ThemeFontScheme

If not, does Aspose offer another way to get hold of these font settings from a Workbook that is opened via Aspose? (I need to copy them from a template Workbook to a generated Workbook).

Many Thanks

Hi,


Please see the document for your reference on how to set cell shading and font colors based on MS Excel 2007/2010 themes.
http://www.aspose.com/docs/display/cellsnet/Excel+2007+Themes+and+Colors

Thank you.

Thanks Amjad for that info and the speedy reply.<?xml:namespace prefix = “o” ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

As far as I can see from that doc you referenced and linked me to, and the
information in it, it only applies to theme/font colors; and not to the
actual Font and all the other Font properties (excluding color).<o:p></o:p>

What I need to work out is what support Aspose Cells has for Themed Fonts…not
just colors or the font color, and specifically as it relates to copying a
worksheet form one Workbook to another.
In other words, I want the Font Themes of one MS Excel
Workbook/Worksheet to be copied to the new Workbook/Worksheet when calling the
Copy() Method on the Aspose Worksheet class. Or failing that, is there
other API methods to do so like with colors…i.e;…<o:p></o:p>

Workbook.CustomTheme(sourceWorkbook.Theme,
colors);

Workbook.CustomTheme(sourceWorkbook.Theme, fonts);…???<o:p></o:p><o:p></o:p>

In Excel (from the Ribbon (Page Layout/Theme/Fonts ) and the API, you can
set Theme Fonts (like (Arial, Calibri…point size etc etc), much like you can
set Theme Colors. These Themed Fonts can then be applied to individual
Cells/Ranges – just like Themed Colors…and if you change the Themed Font it
will replicate and apply to the Workbook/Worksheet in question.<o:p></o:p>

I can’t find anywhere in the Aspose Cells Object Model where you can
manipulate them and do likewise? But
maybe I have not stumbled upon it…???<o:p></o:p>

Any help you could provide would be most appreciated.<o:p></o:p>

Many Thanks,

Mike

Hi,


We appreciate if you could paste your sample code or attach a sample console application (you may zip prior attaching here) with your template files here to show the issue regarding Aspose.Cells, we will check your issue soon. If we found the issue, we will log it into our database (as a new feature or a bug), so your issue could be figured out soon.

Thank you.

Hi Amjad,

Attached is a zip that contains some code that tries to replicate the problem.

I have commented the code to try and help you understand the issue.

I have also attached a couple of Template .xlsx files that you can throw in C:\ to run the tests.

I found a workaround that seems to work, and that is to manually copy the themes to the destination workbook before copying the individual worksheet.

Also, please see my post re theme fonts not being copied (post 461269).

Hope the attached helps. Please don't hesitate to contact me if you need more information or if I can help further sort this issue out.

Many Thanks,

Mike

Hi,


I have checked your project a bit. Well, your proposed workaround is ok as MS Excel themes are stored at the workbook level so, copying worksheet from one workbook to another workbook might not do it for you. You have to get/copy each Themes color individually from the source workbook to destination workbook accordingly.

Thank you.

Thanks Amjad,

I still need to understand how I can get the Theme Fonts copied from Workbook/Worksheet to another. (I understand there could be a few issues with colors, but have found a suitable workaround for the time being).

However, I really do need to ensure that when copying a Workbook/Worksheet the Theme Fonts get copied, or if not there is a manual way to do it (like there is for Theme Colors), which I haven't found.

The project/files I attached to 461907 in reply to 461886 demonstrates the Font copy issue...i.e., they don't seem to be copied.

Could you take a look at this issue and advise if there is any way to achieve this please.

Many Thanks,

Mike

Hi Mike,


You are right. I can notice the issue as you have mentioned. When using your workaround to manually copy the themes from source workbook to another workbook, the colors do copied fine but the fonts are not copied even text is ok/same. We need to check whether we could provide some APIs to copy Themes (colors and fonts) from one workbook to another workbook in one go or provide you some more options or workaround for your needs. We will also check if we can enhance Workbook.Copy or Worksheet.Copy method so that you should not use your workaround (if possible)

I have logged a ticket with an id “CELLSNET-41650” for your needs/issue. Our concerned developer will look into it. Please spare us a little time. Once we have any update on it, we will let you know here.

Thank you.

Thank you very much Amjad...much appreciated.

If I can help out, maybe help test your changes, I would be more than willing to do so. Just let me know.

Again, thanks and I look forward to hearing back from you.

Cheers,

Mike

Hi,

Thanks for your posting and using Aspose.Cells.

We will provide Workbook.CopyTheme method later. Does it fit your needs?

Thanks - that would be great if it can copy the colors and the fonts.

Hi,

We added Workbook.CopyTheme method in the Aspose.Cells for .NET v7.4.3.2.

Please download and try this fix: Aspose.Cells for .NET v7.4.3.2

Feel free to contact us if you need further help or have any issue.

Thank you.