Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- private static string Csv2Html(string[,] fileContent)
- {
- string html = "<html><body><table>";
- for(int y = 0; y < fileContent.GetLength(0); y++)
- {
- html += "<tr>";
- for(int x = 0; x < fileContent.GetLength(1); x++)
- {
- // Header
- if(y == 0)
- {
- html += "<th>" + fileContent[y, x] + "</th>";
- }
- // The rest
- else
- {
- html += "<td>" + fileContent[y, x] + "</td>";
- }
- }
- html += "</tr>";
- }
- return html + "</table></body></html>";
- }
- public static void Main()
- {
- string[,] csv = new string[,] {{"c1", "c2"}, {"1.1", "23.3"}, {"3.1", "3.4"}};
- Console.WriteLine(Csv2Html(csv));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement