Free Support Forum - aspose.com

Using a Class to be able to easily import pre-defined style elements

I am finding myself creating more and more documents "on the fly", and setting all the styles and formats, especially withing tables, can be quite tedious.

Does anyone have any examples of where they have created a separate class that can be instantiated and used within the DocumentBuilder iteration to pull in a "set" of formats? I can use C# to differentiate appropriately with some sort of overload, or naming scheme.

But I'm trying to figure out how to basically build say a CellFormat collection and just pull that in with one line from within where I'm using DocumentBuilder.

Thanks.

Marvin

Hi Marvin,

Thanks for your request. You can create a helper method that accepts DocumentBuilder object as an input parameter and sets all properties you need. For example code can look like the following:

private static void SetCellFormat(DocumentBuilder builder)

{

// Here you sett all properties of CellFormat you need.

}

Hope this helps.

Best regards,