VC6 uses libxl to change the cell fill color

//One ----The situation of the newly created format

IFormatT<TCHAR>* pformat=book->addFormat();

pformat->setBorderTop();//Draw a border on the top edge of the cell
pformat->setBorderLeft();//Draw a border on the left edge of the cell
pformat->setBorderBottom();//Draw a border on the bottom edge of the cell
pformat->setBorderRight( );//Draw a border on the right edge of the cell
pformat->setBorderTopColor(COLOR_BLACK);//The upper border of the cell is black
pformat->setBorderLeftColor(COLOR_BLACK);//The left border of the cell is black
pformat->setBorderBottomColor(COLOR_BLACK); //The bottom border of the cell is black
pformat->setBorderRightColor(COLOR_BLACK);//The right border of the cell is black
pformat->setAlignH(ALIGNH_CENTER);//Cell X is aligned in the center
pformat->setAlignV(ALIGNV_CENTER);//Cell X grid centered
pformat-> setFillPattern (FILLPATTERN_SOLID); // Y cells centered
pformat-> setFillPattern (FILLPATTERN_SOLID); // fill style
pformat-> setPatternForegroundColor (COLOR_RED); // fill color: red

pSheet->setCellFormat(0,0,pformat1);//Fill cells

//Two---Do not change the previous format (including font, center, bold, etc.), just fill

IFormatT<TCHAR>* pformat;//application format variable

CString strIn=pSheet->readStr(0,0,&pformat);//Read the cell format that needs to be filled

IFormatT<TCHAR>* pformat1=book->addFormat(pformat);

pformat1->setFillPattern(FILLPATTERN_SOLID);//Filling style

pformat1->setPatternForegroundColor(COLOR_RED);//Filling color: red

pSheet->setCellFormat(0,0,pformat1);//Fill cells

 

//Three---Do not change the previous format (including font, center, bold, etc.), just fill

IFormatT<TCHAR>* pformat;//application format variable

CString strIn=pSheet->readStr(0,0,&pformat);//Read the cell format that needs to be filled

pformat->setFillPattern(FILLPATTERN_SOLID);//Filling style

pformat1->setPatternForegroundColor(COLOR_RED);//Filling color: red

pSheet->setCellFormat(0,0,pformat1);//Fill cells

 

Guess you like

Origin blog.csdn.net/Hat_man_/article/details/107785955
Recommended