# C1.WPF.Excel.XLCell.SetValue

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_WPF_Excel_XLCell_SetValue_" data-uid="C1.WPF.Excel.XLCell.SetValue*">SetValue Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_WPF_Excel_XLCell_SetValue_" data-uid="C1.WPF.Excel.XLCell.SetValue*"></a>
<h4 id="C1_WPF_Excel_XLCell_SetValue_System_Object_C1_WPF_Excel_XLStyle_" data-uid="C1.WPF.Excel.XLCell.SetValue(System.Object,C1.WPF.Excel.XLStyle)">SetValue(object, XLStyle)</h4>
<div class="markdown level1 summary"><p>Sets the <a class="xref" href="C1.WPF.Excel.XLCell.Value.html#C1_WPF_Excel_XLCell_Value">Value</a> and <a class="xref" href="C1.WPF.Excel.XLCell.Style.html#C1_WPF_Excel_XLCell_Style">Style</a> properties of a cell.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void SetValue(object value, XLStyle style)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub SetValue(value As Object, style As XLStyle)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></td>
      <td><span class="parametername">value</span></td>
      <td><p>New cell value.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.WPF.Excel.XLStyle.html">XLStyle</a></td>
      <td><span class="parametername">style</span></td>
      <td><p>New cell style.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_WPF_Excel_XLCell_SetValue_System_Object_C1_WPF_Excel_XLStyle__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This method allows you to set the Value and Style properties of a cell
simultaneously. This can make your code more compact and easier to maintain.
For example:</p>
<pre><code class="lang-csharp">// set cell value and style (short version)
sheet[0,0].SetValue("Hello", styleBold);

// set cell value and style (longer version)
sheet[0,0].Value = "Hello";
sheet[0,0].Style = styleBold;</code></pre>
</div>
</div>
