gpt4 book ai didi

excel - 为什么没有应用我的背景颜色(Aspose Cells)?

转载 作者:行者123 更新时间:2023-12-04 20:36:38 26 4
gpt4 key购买 nike

我正在尝试为单元格的背景添加颜色,如下所示:

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

在更多上下文中:
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);

但是,未应用浅蓝色:

enter image description here

不过,有些事情正在发生,因为看起来界定细胞的垂直线的中间部分已被删除。我不知道为什么,或者如果与浅蓝色的难以忍受的隐形有任何联系。在添加该代码(第一个片段)之前,那些污迹/删除不是 [in] 可见的。

最佳答案

请注意,如果图案是纯色的,则应使用 Style.ForegroundColor 来绘制单元格(或范围)。此外,如果图案不是纯色或无,则应将 Style.BackgroundColor 用于相同的场景。

注意:我在 Aspose 担任开发人员布道师。

关于excel - 为什么没有应用我的背景颜色(Aspose Cells)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41572571/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com