Generating spreadsheet with conditional formatting

Home Forums SpreadsheetML Generating spreadsheet with conditional formatting

This topic contains 3 replies, has 4 voices, and was last updated by  Jim Snyder 8 years, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3520

    Leebean01
    Participant

    I am generating Excel files from C# data tables on a .Net website, and have successfully added fonts, fills, borders, tables, etc. to cells in the worksheet. I am stuck trying to add conditional formatting to my cells. I have found some examples of what is required when generating the XML directly, but nothing to help me in my C# using Open XML. Is there any guidance or resources available showing how this can be accomplished?

    #3534

    Eric White
    Keymaster

    I don’t know of any examples that give guidance / resources that show how to accomplish this.

    With regards to writing C# code using the Open-Xml-Sdk, I personally prefer to generate the markup directly, and not use the strongly typed classes in the Open-Xml-Sdk object model. I prefer to use the LINQ to XML API.

    My recommendation to you: I suggest writing the markup directly, and not using the strongly-typed OM. Since you have found examples of what is required when generating the XML directly, you are on the path to success.

    #3565

    fifa1234
    Participant

    I apperceive how to get Blackbars in CS:GO. You go to Nvidia Ascendancy Panel, you accept “Adjust desktop admeasurement and position”, You aces Aspect CSGO Keys and beneath “Perform ascent on:” you accept GPU. But GPU isn’t an advantage there. I can alone accept Display TO Buy csgo skins. It has happened that GPU has appear up alert and because of that the Blackbars accept CSGO Skins to work. But afresh just as al of a sudden as the GPU advantage appeared, it disappeared. What do I accept to do to accomplish the GPU advantage be there? Thank you for the help.

    #3601

    Jim Snyder
    Participant

    Fifa, I do not see the correlation to generating conditional formatting in Excel.
    Leebean, I am working on the same thing at the moment. From your post, you have successfully built a stylesheet. I have found a few links that are helping me. The key thing I got from this article was that entries for DifferentialFormats and TableStyles must exist to get the completed spreadsheet to open. I have been working on trying to flesh that out with official details for a few days. The pertinent code is:

        DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U };
        TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium2", DefaultPivotStyle = "PivotStyleMedium9" };
    
    ...
    
        stylesheet1.Append(fonts1);
        stylesheet1.Append(fills1);
        stylesheet1.Append(borders1);
        stylesheet1.Append(cellStyleFormats1);
        stylesheet1.Append(cellFormats1);
        stylesheet1.Append(cellStyles1);
        stylesheet1.Append(differentialFormats1);
        stylesheet1.Append(tableStyles1);
        stylesheet1.Append(stylesheetExtensionList1);
        return stylesheet1;
    
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.