/
Measurement Units
Information Classification: External Restricted.
See https://www.chili-publish.com/security
Measurement Units
All measurement units used in CHILI Publisher (both documents and certain Resource Items) follow the following format:
"VALUE UNIT"
Value is a decimal
Unit is one of the following values:
- blank (in which case the default is assumed, see lower)
- mm
- pt
- in
- cm
For example:
- 10 mm
- 5.825 in
- 20 pt
If no unit is included, the default unit is assumed (either when setting or getting the value). In a document, that is the documents defaultMeasurementUnit (found in ViewPreferences). For all other resources it is the Environments default unit.
Conversion
If you require the values in points or another unit, you can use the following logic:
public double ValueToPt(string val, string defaultUnit) { double dif = 1; if (val == "") return 0; try { //If the value is a double (without unit included), we append the default unit double num = Double.Parse(val); val += " " + defaultUnit; } catch { } if (val.IndexOf("cm") > 0) { dif = 28.346; val = val.Replace("cm", ""); } if (val.IndexOf("mm") > 0) { dif = 2.8346; val = val.Replace("mm", ""); } if (val.IndexOf("in") > 0) { dif = 72; val = val.Replace("in", ""); } if (val.IndexOf("pt") > 0) { dif = 1; val = val.Replace("pt", ""); } val = val.Replace(" ", ""); Double res = Double.Parse(val) * dif; return res; }
, multiple selections available,
Related content
JavaScript Navigation
JavaScript Navigation
Read with this
ViewPreference Settings
ViewPreference Settings
More like this
Panel: CHILI Converter 4
Panel: CHILI Converter 4
More like this
List of available elements - DocumentSettings
List of available elements - DocumentSettings
More like this
Resources
Resources
More like this
Editor Enumerations - Units
Editor Enumerations - Units
More like this
All information on this page must be treated as External Restricted, or more strict. https://www.chili-publish.com/security