Header Colors with Different Cell Types

Posted by: smiley-fp on 8 September 2017, 1:26 pm EST

  • Posted 8 September 2017, 1:26 pm EST

    Hi, I have two questions:

    I have many spread sheets that have header text that needs to wrap onto two lines. I think that the only way to do this is to make the cell type a text and set the wrap text and multi-line to true. Can you please confirm if this is true or not?

    My other question is that I need to have gradient header cells. I have used the following code and it works great, if I am using the default header cell type (not text). If I changed the cell type to text for the word wrap, it does not work as well as the 3-D border colors.

            Dim gc As New FarPoint.Win.Spread.CellType.GradientHeaderRenderer(System.Drawing.Color.FromArgb(255, 225, 235, 255), System.Drawing.Color.FromArgb(255, 200, 215, 255), System.Drawing.Color.FromArgb(255, 225, 235, 255), System.Drawing.Color.FromArgb(255, 200, 215, 255), Drawing2D.LinearGradientMode.Vertical)
            ssCustomers.ActiveSheet.ColumnHeader.Rows(0).Renderer = gc

     I also tried the following example for a solid color, which I don't want, but I tried it anyway trying to solve this.

             Dim darkstyle As New FarPoint.Win.Spread.StyleInfo()
            darkstyle.BackColor = Color.Teal
            darkstyle.ForeColor = Color.Yellow
            ssCustomers.ActiveSheet.ColumnHeader.DefaultStyle = darkstyle

     It will color the background on the cells that have a cell type of text the teal color and all of the cells text (ForeColor) yellow.

     Bottom line, I need to do to have a gradient background for text and default type header cells. Can you help with this?

     -Justin


     


     

  • Replied 8 September 2017, 1:26 pm EST

    Justin -

    By default the text in the header should always wrap so you should not need to change the CellType for the header.

  • Replied 8 September 2017, 1:26 pm EST

    Bob,

     I am using 3.0, and I cannot get it to work like you stated. Is this only in 4.0?
     

  • Replied 8 September 2017, 1:26 pm EST

    Justin -

    Here's what I did.  I clicked on a column header in designer and set the Label property to a long string.  When you click off you will see the label change and it will be wrapped.  Of course you will have to adjust the width of the column and the height of the row in the header so that it meets your needs.

  • Replied 8 September 2017, 1:26 pm EST

    Hi Bob,

     I don't think that it works that way unless I am doing something incorrect. I am highlighting the cell, going to headers, changing the text property and accepting it in the Spread Designer. The text is not wrapped.

     

     

  • Replied 8 September 2017, 1:26 pm EST

    Make sure you download the latest maintenance release.  This is working correctly in my testing.  Also make sure the column width is wide enough.
  • Replied 8 September 2017, 1:26 pm EST

    I've attached a small project using v3.

    2008/08/ColumnWrap.zip
  • Replied 8 September 2017, 1:26 pm EST

    Bob,

     I opened the project, and this is what I am getting for an error when I dbl clicked on the form:

    The designer cannot process the code at line 29:
    Me.FpSpread1.AccessibleDescription = "" The code within the method
    'InitializeComponent' is generated by the designer and should not be manually
    modified. Please remove any changes and try opening the designer again.

    at
    Microsoft.VisualStudio.Design.Serialization.CodeDom.XML.CodeDomXmlProcessor.CreateQuoteExpression(XmlElementData
    xmlElement)
    at
    Microsoft.VisualStudio.Design.Serialization.CodeDom.XML.CodeDomXmlProcessor.XmlElementData.get_CodeDomElement()
    at
    Microsoft.VisualStudio.Design.Serialization.CodeDom.XML.CodeDomXmlProcessor.EndElement(String
    prefix, String name, String urn)
    at
    Microsoft.VisualStudio.Design.Serialization.CodeDom.XML.CodeDomXmlProcessor.Parse(XmlReader
    reader)
    at
    Microsoft.VisualStudio.Design.Serialization.CodeDom.XML.CodeDomXmlProcessor.ParseXml(String
    xmlStream, CodeStatementCollection statementCollection, String fileName, String
    methodName)
    at
    Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnMethodPopulateStatements(Object
    sender, EventArgs e)
    at
    System.CodeDom.CodeMemberMethod.get_Statements()
    at
    System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager
    manager, CodeTypeDeclaration declaration)
    at
    System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
    manager)
    at
    Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
    serializationManager)
    at
    Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32
    fReload)


     

  • Replied 8 September 2017, 1:26 pm EST

    Bob,

     I was able to get the project to work (open). I see this in the form:

     

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        FpSpread1.ActiveSheet.ColumnHeader.Rows(0).Height = 60
        FpSpread1.ActiveSheet.Columns(0).Label = "This is a lot of text"
    End Sub

     

    The results on my computer are that it shows the text, but it is not wrapped. (Same results that I was getting.)


     

  • Replied 8 September 2017, 1:26 pm EST

    Bob,

    Sorry, being a programmer I should have been more explicit. I am changing the label property to a "This is a lot of text" and pressing Enter. The text goes into the header cell, but I cannot read all of it because it is cut off on the sides (not wrapping). I even started a new project with just one form and one control to make sure it wasn't my project.

  • Replied 8 September 2017, 1:26 pm EST

    Bob,

     If I upgrade from v3 to v4, am I going to have to redo all of the forms that have spread sheet controls in it? Also, is the log in name/pw the same for the updates as it is for the forum?

     
    -Justin
     

  • Replied 8 September 2017, 1:26 pm EST

    What part isn't working?  It works for me using v3.
  • Replied 8 September 2017, 1:26 pm EST

    Good news, it is now working! Thank you so much for your help.

    I only ask about v4 because I have the maintenance agreement, so I can upgrade to v4 for free. If I upgrade, will that mess up anything? I have a around 60 forms (and still adding to it) that have at least one spread sheet control in them.

     
    -Justin 

  • Replied 8 September 2017, 1:26 pm EST

    Hello,


    In version 4, we added many EnhancedRenderers to draw the Spread like the Office 2007 Excel spreadsheet. This is the default look for the Spread.

  • Replied 8 September 2017, 1:26 pm EST

    I was able to upgrade to v4 without any problems, thank you very much for your help. I now see the text in the header acting differently, more like Bob described.

    I think that the only question that I now have is, is it now default to have the header a gradient blue like MS, which is what I was trying to do anyway?

     

  • Replied 8 September 2017, 1:26 pm EST

    Justin,


    You should be able to just replace the references in your project to the version 4 assemblies and everything should be fine. You can make a copy of your project and test this in the copy.

  • Replied 8 September 2017, 1:26 pm EST

    Justin -

    You wouldn't need to upgrade to v4.  I tested this with the latest version of 3 and it worked fine for me.  The name/pw should be the same, I believe.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels