Excel Interior.ColorIndex色彩列表

无色

0

 

19

 

38

 

1

 

20

 

39

白色

2

 

21

 

40

 

3

 

22

 

41

 

4

 

23

 

42

 

5

 

24

 

43

 

6

 

25

 

44

 

7

 

26

 

45

 

8

 

27

 

46

 

9

 

28

 

47

 

10

 

29

 

48

 

11

 

30

 

49

 

12

 

31

 

50

 

13

 

32

 

51

 

14

 

33

 

52

 

15

 

34

 

53

 

16

 

35

 

54

 

17

 

36

 

55

 

18

 

37

 

56

对用的Interior.ColorIndex色彩列表。

在C# 对Excel编程中的使用:

 for (int i = 5; i < countRow + 1; i++)
            {
                string strKB = null;
                Microsoft.Office.Interop.Excel.Range kbrng = (Microsoft.Office.Interop.Excel.Range)sheSource.Cells[i, 1];
                if (kbrng.Value2 != null)
                    strKB = kbrng.Value2.ToString();
                if (strTotal.Contains(strKB))
                    kbrng.Interior.ColorIndex = 3;
            }
原文地址:https://www.cnblogs.com/herbert/p/1768259.html