private void StyleAddBorder(ref StyleInformation style) { style.Name += "Border"; style.LeftBorder = ExcelBorderStyle.Thin; style.TopBorder = ExcelBorderStyle.Thin; style.RightBorder = ExcelBorderStyle.Thin; style.BottomBorder = ExcelBorderStyle.Thin; }
private void SetStyleFromInformation(ExcelStyle rangeStyle, StyleInformation information) { rangeStyle.Font.Name = "Arial"; rangeStyle.Font.Size = 10; rangeStyle.Numberformat.Format = information.NumberFormat; if (information.HorizontalAlignment.HasValue) { rangeStyle.HorizontalAlignment = information.HorizontalAlignment.Value; } if (information.VerticalAlignment.HasValue) { rangeStyle.VerticalAlignment = information.VerticalAlignment.Value; } if (information.WrapText.HasValue) { rangeStyle.WrapText = information.WrapText.Value; } if (information.FontName != null && information.FontName.Length > 0) { rangeStyle.Font.Name = information.FontName; } if (information.Bold.HasValue) { rangeStyle.Font.Bold = information.Bold.Value; } if (information.FillPattern.HasValue) { rangeStyle.Fill.PatternType = information.FillPattern.Value; if (information.BackgroundColour.HasValue) { rangeStyle.Fill.BackgroundColor.SetColor(information.BackgroundColour.Value); } } if (information.LeftBorder.HasValue) { rangeStyle.Border.Left.Style = information.LeftBorder.Value; } if (information.TopBorder.HasValue) { rangeStyle.Border.Top.Style = information.TopBorder.Value; } if (information.RightBorder.HasValue) { rangeStyle.Border.Right.Style = information.RightBorder.Value; } if (information.BottomBorder.HasValue) { rangeStyle.Border.Bottom.Style = information.BottomBorder.Value; } }
public StyleInformation getStyleInformationFromStyleName(int m_modelYear, string m_makeName, string m_modelName, string m_trimName, string m_manufacturerModelCode, double m_wheelBase, string[] m_manufacturerOptionCodes, string[] m_equipmentDescriptions, string m_exteriorColorName, string m_interiorColorName) { StyleInformationFromStyleNameRequest m_Sifsmr = new StyleInformationFromStyleNameRequest(); ReturnParameters rd = new ReturnParameters(); rd.excludeFleetOnlyStyles = true; rd.useSafeStandards = true; rd.includeAvailableEquipment = true; rd.includeExtendedDescriptions = true; rd.includeConsumerInformation = false; rd.includeExtendedTechnicalSpecifications = true; rd.includeRegionSpecificStyles = false; rd.enableEnrichedVehicleEquipment = true; m_Sifsmr.accountInfo = this.getAccountInfo(); m_Sifsmr.modelYear = m_modelYear; m_Sifsmr.makeName = m_makeName; m_Sifsmr.modelName = m_modelName; m_Sifsmr.trimName = m_trimName; m_Sifsmr.manufacturerModelCode = m_manufacturerModelCode; m_Sifsmr.wheelBase = m_wheelBase; m_Sifsmr.manufacturerOptionCodes = m_manufacturerOptionCodes; m_Sifsmr.equipmentDescriptions = m_equipmentDescriptions; m_Sifsmr.exteriorColorName = m_exteriorColorName; m_Sifsmr.interiorColorName = m_interiorColorName; m_Sifsmr.returnParameters = rd; StyleInformation temp = vinService.getStyleInformationFromStyleName(m_Sifsmr); if (temp != null) { if (temp.responseStatus.responseCode.Equals(ResponseCode.Successful)) { return(temp); } else { return(null); } } else { return(null); } }
/// <summary> /// Generate a dictionary of available styles and their configuration. /// </summary> private void SetUpStyleDictionary() { StyleInformation newStyle; ExcelHorizontalAlignment[] alignments = new ExcelHorizontalAlignment[] { ExcelHorizontalAlignment.Left, ExcelHorizontalAlignment.Center, ExcelHorizontalAlignment.Right }; foreach (StyleInformation style in m_styleBases) { foreach (ExcelHorizontalAlignment alignment in alignments) { newStyle = (StyleInformation)style.Clone(); switch (alignment) { case ExcelHorizontalAlignment.Left: StyleAddLeft(ref newStyle); m_styleDictionary.Add(newStyle.Name, (StyleInformation)newStyle.Clone()); // Left break; case ExcelHorizontalAlignment.Center: StyleAddCenter(ref newStyle); m_styleDictionary.Add(newStyle.Name, (StyleInformation)newStyle.Clone()); // Center break; case ExcelHorizontalAlignment.Right: StyleAddRight(ref newStyle); m_styleDictionary.Add(newStyle.Name, (StyleInformation)newStyle.Clone()); // Right break; } StyleInformation borderClone = (StyleInformation)newStyle.Clone(); StyleInformation backgroundClone = (StyleInformation)newStyle.Clone(); StyleAddBold(ref newStyle); // [LCR]Bold m_styleDictionary.Add(newStyle.Name, (StyleInformation)newStyle.Clone()); StyleInformation boldBackgroundClone = (StyleInformation)newStyle.Clone(); StyleAddBorder(ref borderClone); // [LCR]Border m_styleDictionary.Add(borderClone.Name, (StyleInformation)borderClone.Clone()); StyleAddBackground(ref borderClone); // [LCR]BorderBackground m_styleDictionary.Add(borderClone.Name, borderClone); StyleAddBackground(ref backgroundClone); // [LCR]Background m_styleDictionary.Add(backgroundClone.Name, backgroundClone); StyleAddBorder(ref newStyle); // [LCR]BoldBorder m_styleDictionary.Add(newStyle.Name, (StyleInformation)newStyle.Clone()); StyleAddBackground(ref newStyle); // [LCR]BoldBorderBackground m_styleDictionary.Add(newStyle.Name, newStyle); StyleAddBackground(ref boldBackgroundClone); // [LCR]BoldBackground m_styleDictionary.Add(boldBackgroundClone.Name, boldBackgroundClone); } } }
private void StyleAddBackground(ref StyleInformation style) { style.Name += "Background"; style.BackgroundColour = Color.LightGray; style.FillPattern = ExcelFillStyle.Solid; }
private void StyleAddBold(ref StyleInformation style) { style.Name += "Bold"; style.Bold = true; }
private void StyleAddRight(ref StyleInformation style) { style.Name += "Right"; style.HorizontalAlignment = ExcelHorizontalAlignment.Right; }
private void StyleAddCenter(ref StyleInformation style) { style.Name += "Center"; style.HorizontalAlignment = ExcelHorizontalAlignment.Center; }
private void StyleAddLeft(ref StyleInformation style) { style.Name += "Left"; style.HorizontalAlignment = ExcelHorizontalAlignment.Left; }