private static string GetExcelCalendarDigits(RPLFormat.Calendars calendar) { switch (calendar) { case RPLFormat.Calendars.Gregorian: return("01"); case RPLFormat.Calendars.GregorianArabic: return("0A"); case RPLFormat.Calendars.GregorianMiddleEastFrench: return("09"); case RPLFormat.Calendars.GregorianTransliteratedEnglish: return("0B"); case RPLFormat.Calendars.GregorianTransliteratedFrench: return("0C"); case RPLFormat.Calendars.GregorianUSEnglish: return("02"); case RPLFormat.Calendars.Hebrew: return("08"); case RPLFormat.Calendars.Hijri: return("06"); case RPLFormat.Calendars.Japanese: return("03"); case RPLFormat.Calendars.Korean: return("05"); case RPLFormat.Calendars.Taiwan: return("04"); case RPLFormat.Calendars.ThaiBuddhist: return("07"); default: return(null); } }
internal static Calendar GetCalendarInstance(RPLFormat.Calendars val) { switch (val) { case RPLFormat.Calendars.GregorianArabic: return(new GregorianCalendar(GregorianCalendarTypes.Arabic)); case RPLFormat.Calendars.GregorianMiddleEastFrench: return(new GregorianCalendar(GregorianCalendarTypes.MiddleEastFrench)); case RPLFormat.Calendars.GregorianTransliteratedEnglish: return(new GregorianCalendar(GregorianCalendarTypes.TransliteratedEnglish)); case RPLFormat.Calendars.GregorianTransliteratedFrench: return(new GregorianCalendar(GregorianCalendarTypes.TransliteratedFrench)); case RPLFormat.Calendars.GregorianUSEnglish: return(new GregorianCalendar(GregorianCalendarTypes.USEnglish)); case RPLFormat.Calendars.Hebrew: return(new HebrewCalendar()); case RPLFormat.Calendars.Hijri: return(new HijriCalendar()); case RPLFormat.Calendars.Japanese: return(new JapaneseCalendar()); case RPLFormat.Calendars.Korean: return(new KoreanCalendar()); case RPLFormat.Calendars.Taiwan: return(new TaiwanCalendar()); case RPLFormat.Calendars.ThaiBuddhist: return(new ThaiBuddhistCalendar()); default: return(new GregorianCalendar()); } }
internal static string GetExcelNumberFormat(string rsNumberFormat, string language, RPLFormat.Calendars rplCalendar, string numeralLanguage, int numeralVariant, TypeCode type, object originalValue, out string hexFormula, out bool invalidFormatCode) { hexFormula = null; string empty = string.Empty; string str = string.Empty; invalidFormatCode = false; if (type != TypeCode.DateTime) { bool isGeneral = false; empty = GetNumberFormat(rsNumberFormat, language, out bool isHex, type, originalValue, ref isGeneral); if (string.IsNullOrEmpty(empty)) { invalidFormatCode = true; } else if (!isHex) { if (empty != null && empty.Length > 0 && empty != "General") { str = GetFormatStringPrefix(rplCalendar, numeralVariant, language, numeralLanguage); } } else { hexFormula = empty; } } else { empty = GetDateTimeFormat(rsNumberFormat, language, rplCalendar); if (string.IsNullOrEmpty(empty)) { invalidFormatCode = true; } else { str = GetFormatStringPrefix(rplCalendar, numeralVariant, language, numeralLanguage); } } return(str + empty); }