2017-01-10 1 views
1

Je suis en train d'ajouter une couleur à l'arrière-plan de mes cellules comme ceci:Pourquoi la couleur de fond n'est-elle pas appliquée (Aspose Cells)?

style.BackgroundColor = Color.LightBlue; 
style.Pattern = BackgroundType.Solid; 

Dans un contexte plus:

Cell shortNameHeaderCell = locationWorksheet.Cells[BYDCBYLOC_HEADING_ROW, SHORTNAME_BYDCBYLOC_COL]; 
shortNameHeaderCell.PutValue("Short Name"); 
style = cf.CreateStyle(); 
style.HorizontalAlignment = TextAlignmentType.Left; 
style.VerticalAlignment = TextAlignmentType.Center; 
style.Font.Name = fontForSheets; 
style.Font.IsBold = true; 
style.Font.Size = 12; 
style.BackgroundColor = Color.LightBlue; 
style.Pattern = BackgroundType.Solid; 
shortNameHeaderCell.SetStyle(style); 

Cell companyNameHeaderCell = locationWorksheet.Cells[BYDCBYLOC_HEADING_ROW, COMPANYNAME_BYDCBYLOC_COL]; 
companyNameHeaderCell.PutValue("Company Name"); 
companyNameHeaderCell.SetStyle(style); 

Cell reasonDescHeaderCell = locationWorksheet.Cells[BYDCBYLOC_HEADING_ROW, REASONDESC_BYDCBYLOC_COL]; 
reasonDescHeaderCell.PutValue("Reason Description"); 
reasonDescHeaderCell.SetStyle(style); 

Cell transTypeHeaderCell = locationWorksheet.Cells[BYDCBYLOC_HEADING_ROW, TRANSTYPE_BYDCBYLOC_COL]; 
transTypeHeaderCell.PutValue("Transaction Type"); 
style = cf.CreateStyle(); 
style.HorizontalAlignment = TextAlignmentType.Center; 
style.Font.Name = fontForSheets; 
style.Font.IsBold = true; 
style.Font.Size = 12; 
style.IsTextWrapped = true; 
style.BackgroundColor = Color.LightBlue; 
style.Pattern = BackgroundType.Solid; 
transTypeHeaderCell.SetStyle(style); 

Cell sumOfQtyOrdHeaderCell = locationWorksheet.Cells[BYDCBYLOC_HEADING_ROW, QTYORD_BYDCBYLOC_COL]; 
sumOfQtyOrdHeaderCell.PutValue("Sum of Qty Ord"); 
sumOfQtyOrdHeaderCell.SetStyle(style); 

Cell sumOfQtyShippedHeaderCell = locationWorksheet.Cells[BYDCBYLOC_HEADING_ROW, QTYSHIPPED_BYDCBYLOC_COL]; 
sumOfQtyShippedHeaderCell.PutValue("Sum of Qty Shipped"); 
sumOfQtyShippedHeaderCell.SetStyle(style); 

Pourtant, la couleur bleu clair est pas appliquée:

enter image description here

Quelque chose se passe, cependant, car il semble que les sections centrales des lignes verticales délimitant les cellules ont été ère sed. Je ne sais pas pourquoi, ou si une connexion quelconque avec l'invisibleness insupportable de la couleur bleu clair. Avant d'ajouter ce code (premier extrait), ces taches/effacements n'étaient pas visibles.

Répondre

1

Veuillez noter que si le motif est plein, Style.ForegroundColor doit être utilisé pour peindre la cellule (ou la plage). De plus, si le modèle n'est pas solide ou aucun, Style.BackgroundColor doit être utilisé pour le même scénario.

Note: Je travaille comme Developer Evangelist chez Aspose.