How can I make "ActiveSheet.PageSetup.PrintTitleRows" with TFlexCelImport?


PrintTitles in Excel are an internal named range, and to change it or read it from FlexCelImport, you need to read or change the corresponding name.

If you look at the help in SetNamedRange, there is an example on how to set print titles there. I will paste the doc for SetNamedRange below:

   /// <summary>
    /// Modifies or adds a Named Range. If the named range exists, it will be modified, else it will be added.
    /// If the range is not user defined (like "Print_Range")
    /// it will have a one-char name, and the value is one of the constants: InternalNameRange_...
    /// Look at the example for more information.
    /// </summary>
    /// <example>
    /// This will create a range for repeating the first 2 columns and rows on each printed page (on sheet 1):
    /// <code>
    /// var
    ///   NamedRange: TXlsNamedRange;
    /// begin
    ///   FlexCelImport1.NewFile;
    ///   InitializeNamedRange(NamedRange);  //To clear it.
    ///   NamedRange.Name:=InternalNameRange_Print_Titles;
    ///   NamedRange.RangeFormula:='=1:2,A:B';
    ///   NamedRange.OptionFlags:=0;
    ///   NamedRange.NameSheetIndex:=1;
    ///   FlexCelImport1.SetNamedRange(NamedRange);
    ///   deletefile('test.xls');
    ///   FlexCelImport1.Save('test.xls');
    /// end;
    /// </code>
    /// Note that in this example in particular (Print_Titles), the range has to have full rows/columns, as this is what Excel expects.
    /// You can not also write "A1:IV2,A1:B65536" in the formula, "A:B" is preferred because it will keep
    /// working in Excel 2007 (That has more columns and rows).
    /// </example>
    /// <param name="NamedRange">Data of the named range. </param>