c#-4.0
  • filehelpers
  • 2016-11-10 6 views 0 likes 
    0

    나는 내 머리글을 따옴표로 표시하려고 노력했지만 불행히도 방법을 알 수는 없습니다. [FieldQuoted('"', QuoteMode.AlwaysQuoted, MultilineMode.NotAllow)] FileHelpers의 인용 된 머리글

    는 데이터 만이 아니라 헤더 작동하고 있지만 난 그냥 수 :

      UserSubEngine.HeaderText = '"WHATEVER,WHATEVER,WHATEVER"'; 
    

    내가 한 줄에 23 다른 헤더를 쓰고 싶지 않습니다.

    차라리 사용합니다 :

      UserSubEngine.HeaderText = UserSubEngine.GetFileHeader(); 
    

    모든 가능한 경우.

    제안 사항?

    답변

    0

    HeaderText입니다. FieldQuotedGetFileHeader()의 출력에 영향을주지 않습니다.

    여기에 source code의 관련 부분이 있습니다.

    /// <summary> 
    /// Builds a line with the name of the fields, for a delimited files it 
    /// uses the same delimiter, for a fixed length field it writes the 
    /// fields names separated with tabs 
    /// </summary> 
    /// <returns>field names structured for the heading of the file</returns> 
    public string GetFileHeader() 
    { 
        var delimiter = "\t"; 
    
        if (RecordInfo.IsDelimited) 
         delimiter = ((DelimitedRecordOptions) Options).Delimiter; 
    
        var res = new StringBuilder(); 
        for (int i = 0; i < RecordInfo.Fields.Length; i++) { 
         if (i > 0) 
          res.Append(delimiter); 
    
         var field = RecordInfo.Fields[i]; 
         res.Append(field.FieldCaption != null 
          ? field.FieldCaption 
          : field.FieldFriendlyName); 
        } 
    
        return res.ToString(); 
    } 
    
    +0

    HeaderText는 내가 사용하기를 원하는 것이 아니며, 어리석게도 깔끔하고 잘못 프로그래밍되어 더 나은 해결책이되어야합니다. –

    +0

    있습니다. [여기] (https://github.com/MarcosMeli/FileHelpers)에 기여할 수있는 좋은 기회입니다. 위의'GetFileHeader()'를 수정하고 pull 요청을 제출하십시오. – shamp00

     관련 문제

    • 관련 문제 없음^_^