I am exporting to Excel using the Enterprise Ag-Grid built in solutions. Whenever I export a zipcode, any zipcode that begins with 0 loses that in the Excel file. I know that Excel supports a special Zip Code format, however, I keep striking out on my attempts.
{
headerName: 'ZIP',
type: 'zip code',
filter: 'number',
unSortIcon: true,
field: 'Zip',
filterParams: {
filterOptions: this.filterOption,
clearButton: true,
applyButton: true
},
minWidth: 120
}
That is how the column is currently defined within the columnDefs of the gridOptions.
Thank you in advance for any assistance or insight you may have.
Regards,
Youssef
You can format the required cells in your spreadsheet as "00000" which will show the required formatting. Format cells->Special->Zip Code.
Related
I have a excel table with contains the following data:
format:
mainheading:
subheading:
mandatory:
fieldname:
type:
description:
function:
optional:
type
description
again cycle repeats. Need to loop through that excel and required for
Need a optimum way to do it. can anyone help how to deal with this excel to json conversion
I have several csv files which they differ between them in term of columns.
I know exactly which column I want to see, but I am not sure if all the files they have those column.
in my previous code, I had in place this sort of filtering
keep_col = ['code', '#timestamp', 'message', 'name','ID', 'deviceAction']
know I implemented a for loop to go through all the files (csv) in a folder and run some scripts against those file.
Here is where I am facing the issue.
as the csv structure may vary, I can't keep the keep_col that static and I needed to add some extra column,
like this:
keep_col = ['code', '#timestamp', 'message', 'name','ad.loginName','sourceServiceName','ad.destinationHosts','ID', 'deviceAction']
but unfortunately my script fails because the the new column I added, are not in the csv index. fair enough, I decided to put in place a ìf statment
as follow:
if 'ad.loginName' and 'sourceServiceName' and 'ad.destinationHosts' in f.index.values:
keep_col = ['Code', '#timestamp', 'message', 'name','ad.loginName','sourceServiceName','ad.destinationHosts','ID', 'deviceAction']
else:
keep_col = ['Code', '#timestamp', 'message', 'name','ID', 'deviceAction']
I tried with both AND and ORand the output was wrong in both cases, and here why:
OR: fails to run because is needs to validate at least one condition, which in my first file does not have any of those column.
AND: works, but does not report back the column because not all 3 conditions are true so it doesn't report back any of those 3 fields.
Please, can any of you help me to solve this.
I would like the script to check IF any of those columns exists, to write them, and if they do not exists in the index, to just ignore them and move on
thank you very much guys, and please if you need more infos just let me know.
I think you mean to check if all indexes you mention are in f.index.value.
if all(col in f.columns
for col in ['ad.loginName', 'sourceServiceName',
'ad.destinationHosts']
):
or in other words if that set is a subset of f.index.values
if set(['ad.loginName', 'sourceServiceName',
'ad.destinationHosts']) <= set(f.columns):
Or back to your original problem you want
keep_col = ['Code', '#timestamp', 'message', 'name','ad.loginName','sourceServiceName','ad.destinationHosts','ID', 'deviceAction']
keep_col = [col for col in keep_col if col in f.columns]
If I tell you 'some string' and 'some other string' == True, can you spot what you did wrong in your code?
I have a sharepoint list. One of the fields in it(called DocNumber) is the document number including version. It will look like this ESI-1234-1.0
Basically the rule is, it should start with the text ESI-, then a number, followed by another hipen(-), followed by version number, then a dot(.), and a subversion number
How do i write the 'Column validation' for this. I'm using Sharepoint Online(365 I guess), so there's a placeholder in field level settings to write this formula. I searched online but the syntax is so difficult that I'm finding it hard to customize the formula -
I need something like this, but i don't want to indicate position because the numbers there could be of any length(its a serial number, currently we are at 1600, so we should support 1 to 5 digits atleast and version could be any number from 1 to 99)
=AND(
IF(ISERROR(FIND("ESI-",DocNumber,1)),FALSE,(FIND("ESI-",DocNumber)=1)),
IF(ISERROR(FIND("-",DocNumber,4)),FALSE,(FIND("-",DocNumber,4)=4)))
Thankyou for your help!
In the formula property of column You may use JSON structure like this:
{
"elmType": "div",
"txtContent": {
"operator": "+",
"operands": [
"ESI-",
"[$ID]",
"-",
"[$_UIVersionString]"
]
}
}
here we make a custom view in a div HTML element with text inside. The Text is static string "ESI-" then we add ID column then we add "-" then we add version number column as string
the result should be something like this
... I hope this will be of any help
I have seen some questions (like this one) here asking about if a cell in Excel can be formatted by NPOI/POI as if formatted by Excel. As most of you, I have to deal with issues with Currency and DateTime. Here let me ask how the formatting can be achieved as if it has been formatted by Excel? (I will answer this question myself as to demonstrate how to do it.)
Setting: Windows 10, English, Region: Taiwan
Excel format: XLSX (version 2007 and later)
(Sorry about various edit of this question as I have pressed the 'Enter' button at unexpected time.)
If you format a cell as Currency, you have 4 choices:
The internal format of each style is as follow:
-NT$1,234.10
<numFmt formatCode=""NT$"#,##0.00" numFmtId="164"/>
[RED]NT$1,234.10
<numFmt formatCode=""NT$"#,##0.00;[Red]"NT$"#,##0.00" numFmtId="164"/>
-NT$1,234.10
<numFmt formatCode=""NT$"#,##0.00_);("NT$"#,##0.00)" numFmtId="7"/>
[RED]-NT$1,234.10
<numFmt formatCode=""NT$"#,##0.00_);[Red]("NT$"#,##0.00)" numFmtId="8"/>
Note: There is a pair of double quote (") comes before and after NT$.
(To get internal format of XLSX, just unzip it. The Style information is available in <unzip dir>\xl\Styles.xml Check out this answer if you need more information.)
(FYI: In formatCode, the '0' represent a digit. The '#' also represent a digit, but will not appear if the number is not large enough. So any number less than 1000 will not have the comma inside it. The '_' is a space holder. In format 3, '1.75' appears as 'NT$1.75 '. The last one is a space.)
(FYI: In numFmtId, for case 1 and case 2, number 164 is for user-defined. For case 3 and 4, number 7 and 8 are build-in style.)
For developers using POI/NPOI, you may find out if you format your currency column using Build In Format using 0x7 or 0x8, you can get only the third or fourth choice. You cannot get the first or second choice.
To get the first choice, you build upon style 0x7 "$#,##0.00);($#,##0.00)". You need to add the currency symbol and the pair of double quotes in front of it.
styleCurrency.DataFormat = workbook.CreateDataFormat().GetFormat("\"NT$\"#,##0.00");
Apply this format to a cell with number. Once you open the Excel result file, right click to check formatting, you will see the first choice.
Please feel free to comment on this post.
var cell5 = row.CreateCell(5, CellType.Numeric);
cell5.SetCellValue(item.OrderTotal);
var styleCurrency = workbook.CreateCellStyle();
styleCurrency.DataFormat= workbook.CreateDataFormat().GetFormat(string.Format("\"{0}\"#,##0.00", item.CurrencySymbol));//styleCurrency;
cell5.CellStyle = styleCurrency;
styleCurrency = null;
Iterate over loop for multiple currency.
Function to GetCurrencySymbol against currency Code on C#
private string GetCurencySymbol(string isOcurrencyCode)
{
return CultureInfo.GetCultures(CultureTypes.AllCultures).Where(c => !c.IsNeutralCulture)
.Select(culture =>
{
try
{
return new RegionInfo(culture.LCID);
}
catch
{
return null;
}
})
.Where(ri => ri != null && ri.ISOCurrencySymbol == isOcurrencyCode)
.Select(ri => ri.CurrencySymbol).FirstOrDefault();}
I have this as a dataset:
I'm having a hard time trying to make a new column to do this.
If there is a duplicate in the user name, see if TF = TRUE, then check to see if VERSION is either "Boxing 2007" OR "Boxing 2010", if it is either of those, return "FLAG IT", if not return "OK"
Can anyone help me out with this?
Using structured references, and assuming the T/F column is Boolean:
=IF(AND(COUNTIF([Username],[#Username])>1, [#[T/F]],
OR([#Version]="Boxing 2007",[#Version]="Boxing 2010")),
"FLAG IT","OK")