PB拆分数据转到EXCEL

UPC 转到EXCEL

 

 xlsub.Cells[9,40]=dw_3.object.q_qsheetitem_upc[1]     //UPC
 xlsub.Cells[9,26]=mid(dw_3.object.q_qsheetitem_upc[1], 1,1) //UPC 第一位数字
 xlsub.Cells[9,27]=mid(dw_3.object.q_qsheetitem_upc[1], 2,1) //UPC 第二位数字
 xlsub.Cells[9,28]=mid(dw_3.object.q_qsheetitem_upc[1], 3,1)  //UPC 第三位数字
 xlsub.Cells[9,29]=mid(dw_3.object.q_qsheetitem_upc[1], 4,1)
 xlsub.Cells[9,30]=mid(dw_3.object.q_qsheetitem_upc[1], 5,1)
 xlsub.Cells[9,31]=mid(dw_3.object.q_qsheetitem_upc[1], 6,1)
 xlsub.Cells[9,32]=mid(dw_3.object.q_qsheetitem_upc[1], 7,1)
 xlsub.Cells[9,33]=mid(dw_3.object.q_qsheetitem_upc[1], 8,1)
 xlsub.Cells[9,34]=mid(dw_3.object.q_qsheetitem_upc[1], 9,1)
 xlsub.Cells[9,35]=mid(dw_3.object.q_qsheetitem_upc[1], 10,1)
 xlsub.Cells[9,36]=mid(dw_3.object.q_qsheetitem_upc[1], 11,1)
 xlsub.Cells[9,37]=mid(dw_3.object.q_qsheetitem_upc[1], 12,1)

 

把一个字段拆分成几段转写到EXCEL里

 

string material,mate
int len_ma,i
long pos_ma
 material=dw_3.object.q_qsheetitem_material_1[1]
 len_ma=len(material)                                                                      //字段长度
 do while len_ma>0
   pos_ma=pos(material,',')                                                            //遇到逗号就拆分
   if pos_ma<>0 then
   xlsub.Cells[36+i,1]=dw_3.object.q_qsheetitem_itemnumber[1] 
   mate=left(material,pos_ma - 1)                                                    //取右边三个字节                          
   xlsub.Cells[36+i,7]=Right(mate, 3)                                                                                       
    xlsub.Cells[36+i,5]=mid(mate,1,len(mate) - 3)                          //减少三个字节      
   material=mid(material,pos_ma+1)
   else
   mate=material
   xlsub.Cells[36+i,1]=dw_3.object.q_qsheetitem_itemnumber[1]
   xlsub.Cells[36+i,5]=mid(mate,1,len(mate) - 3)
   xlsub.Cells[36+i,7]=Right(mate, 3)
   material=''
      end if
  len_ma=len(material)
    i=i+1
 loop

 

 

把material数据   转到EXCEL里,本格式如下:

material=

 

“ACRYLIC PLUSH FABRIC 60%,POLYESTER FIBER STUFFING 20%,PLASTIC ACCESSORIES 5%,SUB-MATERIAL 15%”

 

ITEM#                                                     成分名称                                               成分含量

123456                                        ACRYLIC PLUSH FABRIC                                   60%

123456                                        POLYESTER FIBER STUFFING                            20%

123456                                        PLASTIC ACCESSORIES                                    5%

123456                                        SUB-MATERIAL                                                 15%

 

你可能感兴趣的:(String,Excel)