怎样用DELPHI控制EXCEL中某一单元格的某一边框是否显示??

解决方案 »

  1.   

    设置range.borders.COLOR为白色即可。
      

  2.   

    Range.Borders.LineStyle := 1; //加边框可以修改這個!!
      

  3.   

    报表通常需要上下封顶的表格线,可以使用Borders集合属性。要注意,VBA中的集合对象通常都有一个缺省的Item属性,Delphi中是不能省略的。Weight属性用于定义表格线的粗细:
    with Aname.RefersToRange,Borders do
    begin
    HorizontalAlignment:= xlRight;
    Item[xlEdgeBottom].Weight:=xlMedium;
    Item[xlEdgeTop].Weight:=xlMedium;
    Item[xlInsideHorizontal].Weight:=xlThin;
    item[xlInsideVertical].Weight:=xlThin;
    end;
      

  4.   

    请问 aiirii(ari-爱的眼睛) Aname是什么??
      

  5.   

    你參考 Borders 這個屬性的設置就可!
      

  6.   

    http://delphi.ktop.com.tw/topic.asp?TOPIC_ID=22668
      

  7.   

    我以搞定了,谢谢!!!
    //先全加上边框
      If RowsNum < 26 then
      begin
        Ranges := sheet.Range['A2:'+ char(Length(TimeNum) + 65)
                + IntToStr(Query1.RecordCount + 4)];
        ranges.Borders.LineStyle := xlContinuous;
        Ranges.WrapText := True;
      end
      else if RowsNum = 26 then
      begin
        Ranges := sheet.Range['A2:Z' + IntToStr(Query1.RecordCount + 4)];
        ranges.Borders.LineStyle := xlContinuous;
        Ranges.WrapText := True;
      end
      else if (RowsNum > 26) and (RowsNum <= 52) then
      //&Egrave;&ccedil;&sup1;&ucirc;&Oacute;&ETH;26&cedil;&ouml;&ordm;&frac12;°à&Ograve;&Ocirc;&Eacute;&Iuml;
      begin
        Ranges := sheet.Range['A2:A'+ char(Length(TimeNum) + 39)
               + IntToStr(Query1.RecordCount + 4)];
        ranges.Borders.LineStyle := xlContinuous;
        Ranges.WrapText := True;
      end
      else if (RowsNum > 52) and (RowsNum <= 78) then
      //&Egrave;&ccedil;&sup1;&ucirc;&Oacute;&ETH;52&cedil;&ouml;&ordm;&frac12;°à&Ograve;&Ocirc;&Eacute;&Iuml;78°à&Ograve;&Ocirc;&Iuml;&Acirc;
      begin
        Ranges := sheet.Range['A2:B'+ char(Length(TimeNum) + 13)
                + IntToStr(Query1.RecordCount + 4)];
        ranges.Borders.LineStyle := xlContinuous;
        Ranges.WrapText := True;
      end
      else if (RowsNum > 78) and (RowsNum <= 104) then
      //&Egrave;&ccedil;&sup1;&ucirc;&Oacute;&ETH;52&cedil;&ouml;&ordm;&frac12;°à&Ograve;&Ocirc;&Eacute;&Iuml;78°à&Ograve;&Ocirc;&Iuml;&Acirc;
      begin
        Ranges := sheet.Range['A2:C'+ char(Length(TimeNum) + 13)
                + IntToStr(Query1.RecordCount + 4)];
        ranges.Borders.LineStyle := xlContinuous;
        Ranges.WrapText := True;
      end;
     //再把不要的边框去掉
      Ranges := sheet.Range['A3:A3'];
      Ranges.borders[xlEdgeTop].LineStyle := xlNone;