I want to display the sequence as AA, AB, AC
and so on.
This sequence should be applied to PDF rows line by line using ItextSharp Library and the Values comes from SQL DB.
eg of sequence-->
1st record AA
2nd record AB
3rd record AC
... and so on
I have code to generate sequence of AA, AB, AC .... so on, But the existing code has many tables with some number of rows, So if first table has 5 rows then the sequence is applied for 5 rows as AA, AB, AC, AD,AE and loop ends for table1, when table2 loop starts the sequence not starting from AF but it is taking as new table and again sequence repetition starting as AA, AB, AC upto so on and for next table again the sequence starts from AA,AB,AC...., The Project Existing code using loops to fetch the data apply to PDF from DB, Whenever new table comes from DB new sequence is getting started.
I am unable solve this problem please someone helpme to overcome this.
String index = "";
PdfPTable table = new PdfPTable(columnWidth.Count()) { TotalWidth = TABLE_WIDTH, LockedWidth = true };
index = GetIndex(table.Size);
private static string mColumnLetters = "zabcdefghijklmnopqrstuvwxyz";
public static string GetIndex(int ColumnIndex)
{
int ModOf26, Subtract;
StringBuilder NumberInLetters = new StringBuilder();
ColumnIndex += 26;
while (ColumnIndex > 0)
{
if (ColumnIndex <= 26)
{
ModOf26 = ColumnIndex;
NumberInLetters.Insert(0, mColumnLetters.Substring(ModOf26, 1));
ColumnIndex = 0;
}
else
{
ModOf26 = ColumnIndex % 26;
Subtract = (ModOf26 == 0) ? 26 : ModOf26;
ColumnIndex = (ColumnIndex - Subtract) / 26;
NumberInLetters.Insert(0, mColumnLetters.Substring(ModOf26, 1));
}
}
return NumberInLetters.ToString().ToUpper();
}
==>Please help me to get the program to display AA, AB, AC, etc without any splits. Getindex(Table.Size)==> here the input parameter making problem i think Instead Table.Size which input should i pass if i have to overcome Splits and repeated seq generation.
==>Can anyone please help me by spending sometime on this regard