Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
ExcelExporter - Increase Margin Indent
posted

i am trying to indent the first column after the ultragrid is exported to excel using excelexporter.

If i use indentation, the bands are moved to new cells to the right.

i am trying to increase the margin between the border and the text cell.

how can i do this in excel exporter or ultragrid?

Thanks

  • 2005
    Verified Answer
    Offline posted

    Hi Fatih,

    You use WorksheetCell.CellFormat.Indent as showing in the code snippet below:

    using (exporter = new UltraGridexporter())
    {
       exporter.ExportEnding += (sender, args) =>
       {
          foreach (WorksheetRow worksheetRow in args.CurrentWorksheet.Rows)
          {
             if (worksheetRow.OutlineLevel > 0)
             {
                WorksheetCell cell = worksheetRow.Cells[0];
                if (cell.Value != null)
                   cell.CellFormat.Indent = worksheetRow.OutlineLevel;
             }
          }
       };
       // add other event handlers
       exporter.Export(ultraGrid, filePath, WorkbookFormat.Excel2007);
    }

    Best Regards,
    Shaolin

  • 21795
    Offline posted

    Hello Fatih,

    What you need actually is not possible in MS Excel. The text in the cells in MS Excel could be aligned horizontally in three ways: to the left, to the right or centered. In your screenshot it seems that the text in the GroupName column are aligned to the left and there is some empty space added to the text.

    So, what you can do, to achieve such outlook, is to add some empty spaces in front of the cell’s text during the export of the grid. Again this is limitation of MS Excel and there is nothing we can do about this.

    Please let me know if you have any additional questions.