OSDN Git Service

Modify "Tools - Generate Report" (Add column width definition to html output) (#1333)
authorstonee-K <105475799+stonee-K@users.noreply.github.com>
Fri, 13 May 2022 12:07:26 +0000 (21:07 +0900)
committerGitHub <noreply@github.com>
Fri, 13 May 2022 12:07:26 +0000 (21:07 +0900)
* Modify column width definition at "GenerateReport"

* Modify column width definition at "GenerateReport"

Src/MergeDoc.cpp

index e5efa7d..863ff44 100644 (file)
@@ -3925,7 +3925,6 @@ bool CMergeDoc::GenerateReport(const String& sFileName) const
        }
 
        file.SetCodepage(ucr::CP_UTF_8);
-
        CString headerText =
                _T("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n")
                _T("\t\"http://www.w3.org/TR/html4/loose.dtd\">\n")
@@ -3944,13 +3943,25 @@ bool CMergeDoc::GenerateReport(const String& sFileName) const
                _T("</style>\n")
                _T("</head>\n")
                _T("<body>\n")
-               _T("<table cellspacing=\"0\" cellpadding=\"0\" style=\"width:100%%;\">\n")
-               _T("<thead>\n")
-               _T("<tr>\n");
+               _T("<table cellspacing=\"0\" cellpadding=\"0\" style=\"width:100%%;\">\n");
        String header = 
                strutils::format((LPCTSTR)headerText, nFontSize, (LPCTSTR)m_pView[0][0]->GetHTMLStyles());
        file.WriteString(header);
 
+       file.WriteString(_T("<colgroup>\n"));
+       for (int nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
+       {
+               String data = strutils::format(
+                       _T("<col style=\"width: 4em;\" />\n")
+                       _T("<col style=\"width: calc(100%% / %d - 4em);\" />\n"),
+                       m_nBuffers);
+               file.WriteString(data);
+       }
+       file.WriteString(
+               _T("</colgroup>\n")
+               _T("<thead>\n")
+               _T("<tr>\n"));
+       
        // Get paths
        // If archive, use archive path + folder + filename inside archive
        // If desc text given, use it
@@ -3973,8 +3984,7 @@ bool CMergeDoc::GenerateReport(const String& sFileName) const
        int nBuffer;
        for (nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
        {
-               String data = strutils::format(_T("<th colspan=\"2\" class=\"title\" style=\"width:%f%%\">"),
-                       (double)100 / m_nBuffers);
+               String data = _T("<th colspan=\"2\" class=\"title\">");
                file.WriteString(data);
                file.WriteString(ucr::toTString(CMarkdown::Entities(ucr::toUTF8(paths[nBuffer]))));
                file.WriteString(_T("</th>\n"));