• <legend id='qzhM2'><style id='qzhM2'><dir id='qzhM2'><q id='qzhM2'></q></dir></style></legend>
      <bdo id='qzhM2'></bdo><ul id='qzhM2'></ul>

        <i id='qzhM2'><tr id='qzhM2'><dt id='qzhM2'><q id='qzhM2'><span id='qzhM2'><b id='qzhM2'><form id='qzhM2'><ins id='qzhM2'></ins><ul id='qzhM2'></ul><sub id='qzhM2'></sub></form><legend id='qzhM2'></legend><bdo id='qzhM2'><pre id='qzhM2'><center id='qzhM2'></center></pre></bdo></b><th id='qzhM2'></th></span></q></dt></tr></i><div id='qzhM2'><tfoot id='qzhM2'></tfoot><dl id='qzhM2'><fieldset id='qzhM2'></fieldset></dl></div>
        <tfoot id='qzhM2'></tfoot>
      1. <small id='qzhM2'></small><noframes id='qzhM2'>

        microsoft.interop.excel 格式化单元格

        时间:2023-05-21
        <legend id='T6hin'><style id='T6hin'><dir id='T6hin'><q id='T6hin'></q></dir></style></legend>
        • <bdo id='T6hin'></bdo><ul id='T6hin'></ul>

          1. <small id='T6hin'></small><noframes id='T6hin'>

                <tfoot id='T6hin'></tfoot>

                  <tbody id='T6hin'></tbody>

                • <i id='T6hin'><tr id='T6hin'><dt id='T6hin'><q id='T6hin'><span id='T6hin'><b id='T6hin'><form id='T6hin'><ins id='T6hin'></ins><ul id='T6hin'></ul><sub id='T6hin'></sub></form><legend id='T6hin'></legend><bdo id='T6hin'><pre id='T6hin'><center id='T6hin'></center></pre></bdo></b><th id='T6hin'></th></span></q></dt></tr></i><div id='T6hin'><tfoot id='T6hin'></tfoot><dl id='T6hin'><fieldset id='T6hin'></fieldset></dl></div>

                  本文介绍了microsoft.interop.excel 格式化单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在使用 C# 中的 microsoft.interop.excel 库构建报告.

                  I am building a report using the microsoft.interop.excel library in C#.

                  我有这样的事情:

                   Range rangeTarget;
                   .
                   .
                   .
                   rangeTarget = worksheet.get_Range("C" + row, "N" + row);
                  

                  我希望范围将其值显示为整数,即没有小数位.我试过 rangeTarge.AutoFormat,但不知道如何使用它.

                  I want the range to display its values as whole numbers i.e. with no decimal places. I've tried rangeTarge.AutoFormat, but have no idea how to use it.

                  有什么想法吗?

                  谢谢.

                  推荐答案

                  参见 MSDN

                  Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
                  this.Controls.AddNamedRange(this.Range["A1", "A5"], "namedRange1");
                  
                  namedRange1.NoteText("This is a Formatting test", missing, missing);
                  namedRange1.Value2 = "Martha";
                  namedRange1.Font.Name = "Verdana";
                  namedRange1.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;
                  namedRange1.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                  namedRange1.BorderAround(missing, Excel.XlBorderWeight.xlThick,
                      Excel.XlColorIndex.xlColorIndexAutomatic, missing);
                  namedRange1.AutoFormat(Excel.XlRangeAutoFormat.xlRangeAutoFormat3DEffects1,
                      true, false, true, false, true, true);
                  
                  if (MessageBox.Show("Clear the formatting and notes?", "Test",
                      MessageBoxButtons.YesNo) == DialogResult.Yes)
                  {
                      namedRange1.ClearFormats();
                      namedRange1.ClearNotes();
                  }
                  

                  这篇关于microsoft.interop.excel 格式化单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:根据 YYYYMMDD 等格式化 .NET DateTime 的最简单方法是什么? 下一篇:C#:IFormattable、IFormatProvider 和 ICustomFormatter 之间的连接,以及何

                  相关文章

                  1. <i id='Ibddz'><tr id='Ibddz'><dt id='Ibddz'><q id='Ibddz'><span id='Ibddz'><b id='Ibddz'><form id='Ibddz'><ins id='Ibddz'></ins><ul id='Ibddz'></ul><sub id='Ibddz'></sub></form><legend id='Ibddz'></legend><bdo id='Ibddz'><pre id='Ibddz'><center id='Ibddz'></center></pre></bdo></b><th id='Ibddz'></th></span></q></dt></tr></i><div id='Ibddz'><tfoot id='Ibddz'></tfoot><dl id='Ibddz'><fieldset id='Ibddz'></fieldset></dl></div>

                      <bdo id='Ibddz'></bdo><ul id='Ibddz'></ul>
                    <legend id='Ibddz'><style id='Ibddz'><dir id='Ibddz'><q id='Ibddz'></q></dir></style></legend>
                    <tfoot id='Ibddz'></tfoot>

                    <small id='Ibddz'></small><noframes id='Ibddz'>