How can i right align a specific column header in Ag-grid for excel export - ag-grid

suppose there are 3 columns and all three are either groupHeaders or normal headers, and i want only one column header to be right alignedwhen i do a excel export . I followed the approach in docs and im able to move all the headers using id:'header'
const excelStyles: ExcelStyle[] = [
{
id: 'header',
alignment: {
horizontal: 'Right'
}
}]
using this im able to move all headers to right in excel export , but i want only one specific header to move towards right side when i do a excel export .
https://www.ag-grid.com/javascript-data-grid/cell-styles/

Related

How to add header content to Material-UI's DataGrid Export to CSV?

I would like to add header content to Material-UI's DataGrid Export to CSV feature. The Export to CSV only exports the contents of the table, but I'm working on a project where the client needs attribution and metadata added to the csv contents. By header content I mean additional string content that is not part of the table data. The content I am looking to add is basic string data and would likely only amount to a few lines.
I'm also open to using the paid XGrid version if that would allow for this.
Any thoughts or ideas for how to achieve this would be appreciated!
The API method getDataAsCSV() allows you to get the CSV as a string. Then, you can replace the Export CSV Button with a custom one which will call getDataAsCSV(), add the metadata to the string and save it.
If you think this is a good-to-have feature, you can open an issue to add metadata as an argument of CsvExportOptions.

Excel::Writer::XLSX adding format after writing to cell

I am writing out a spreadsheet using the Excel::Writer::XLSX module and everything works fine. I wanted to ask if it is possible to issue a 'set_column' with a particular format to change some columns that have already been written using another format. The older format does not use the border attribute. Does the new format using the add_column override the old format from the previous write?
I'm basically putting borders around certain columns using the add_column, but the add_column is not doing it.
my $fmt_border = $workbook->add_format( border => 1);
$worksheet->set_column( 'A:A', 40, $fmt_border );

How to specify the sheet name in Excel Export (NOT file name) - Ag-Grid

When we export to excel in AgGrid, the default sheet name is ag-grid. How can I change it to another name?
const params = {
columnWidth: 100,
fileName: 'Your File Name',
sheetName:'Your Sheet Name'
};
this.gridApi.exportDataAsExcel(params);
You can pass params inside exportDataAsExcel() function.
Yes, you can use the function getDataAsExcel(params) to generate the XML, then parse through it for the Worksheet element and change the ss:Name attribute to whatever you want for your sheet name. It might be safe to just use str.replace looking for 'ag-grid', but I am not certain on that.
Once that is done you just need to download the string/blob as a file.

How to make header and footer in excel via matlab using excel VBA

Im trying to make header and footer in excel via matlab using excel VBA. So far i did some manipulations with cells but header and footer is a problem.
Here is a code in matlab that opens actxserver and i tried this:
Excel = actxserver('Excel.Application');
Workbooks = Excel.Workbooks;
Excel.Visible = 0;
location=strcat(pwd,'\','testdoc.xlsx');
Workbook = Excel.Workbooks.Open(location);
%%
Excel.PageSetup.LeftHeader='TEST';
%%
Workbook.Save;
Excel.Quit;
I am trying to do next. I am trying to make header on the left,center and right side and make a footer with page number on center and two strings on right and left. Lets use this string 'TEST' for all operations in header and footer. I want to do this in matlab of course.
This is the reference https://msdn.microsoft.com/en-us/library/bb225426(v=office.12).aspx
And this is an example how it works in VBA but i dont know how to do that in matlab using actxserver.
Sub Date_Time()
ActiveSheet.PageSetup.CenterHeader = "&D &B&ITime:&I&B&T"
End Sub
Or:
Worksheets("SomeSheet").PageSetup.LeftHeader = "Some Text"
I am a bit confused. Tnx in advance.
You need to set headers and footers for an individual worksheet, not for Excel itself. So if Excel is your MATLAB variable representing a connection to Excel, you could within MATLAB use something like:
Excel.Worksheets.Item(1).PageSetup.CenterHeader = 'hello';
You can of course refer to Item(2) etc for later worksheets, and you can also use the ActiveSheet property of Excel rather than Worksheets.Item(1) to refer to the active worksheet (i.e. Excel.ActiveSheet.PageSetup.CenterHeader = ....
Hope that helps!

Crystal Report: export to excell generates "page break", column header is reapeated

Trying to export a report to excel, the generated document has kind of page break. The column header is repeated. The "page break" are in the same positition than if I generate a PDF report.
How can I remove this page break when exporting to excel? Is there some page size definition?
Have you tried ExportFormatType.ExcelRecord instead of ExportFormatType.Excel? The xls file will be created without formatting.
If actually the user is exporting report using ReportViewer Toolbar Export button you can:
Replace the CrystalReportViewer Control with the ReportExporter Control. It will export the report in the format you choose.
Or hide Export button from toolbar and put in the page buttons that exports programmatically
Call ExportToHttpResponse method
CrystalReportSource1.ReportDocument.ExportToHttpResponse(ExportFormatType.ExcelRecord, this.Response , false, "report.xls");
Call ExportToDisk method
reportDocument.ExportToDisk(ExportFormatType.ExcelRecord, "report.xls");
Export dataset to excel (Look at Ahmed answer)
You can choose the way that best fits your needs, but you must try if it works with the runtime you use either in development or in release server.
ExportFormatType.ExcelRecord means that is generated an xls file, without formatting. If you set ExportFormatType.Excel fields that are marked as "Can Grow" are merged with an otherwise blank row below them.