ComWrapper and FontSettings Issue

I have a ComWrapper from v14 and I am trying to upgrade to 19. When I build the ComWrapper, I get this error:

|Error|CS0120|An object reference is required for the non-static field, method, or property ‘FontSettings.GetFontsSources()’|AsposeComWrapper|C:\Users\Royn\source\repos\AsposeComWrapper\AsposeComWrapper\Class1.cs|21|Active|

The error seems to com from this line

        ArrayList fontSources = new ArrayList(FontSettings.GetFontsSources());

How do I fix?


Thanks for your inquiry. Could you please share ComWrapper Visual Studio 2017 application here for testing? Thanks for your cooperation. (4.0 MB)

Here is my AsposeComWrapper. I would also like to add the following functions. Can You do that for me as well.


Thanks for sharing the detail. You need to use FontSettings.DefaultInstance as shown below to fix this issue.

public void SetFontFolder(object myFolder)
    ArrayList fontSources = new ArrayList(FontSettings.DefaultInstance.GetFontsSources());
    FolderFontSource folderFontSource = new FolderFontSource(myFolder.ToString(), true);
    FontSourceBase[] updatedFontSources = (FontSourceBase[])fontSources.ToArray(typeof(FontSourceBase));

Thanks, can your provide me examples of 2 functions I need to add to the COM Wrapper:

  1. Input Parameter (a file name path of a jpg). Function inserts the image as background image for the entire page (no margins,etc)
  2. Input Parameter ( text string and overlay location). Function places text at location and on top of background image above.


Thanks for your inquiry. Please manually create your expected Word documents using Microsoft Word and attach them here for our reference. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.