mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 09:35:37 -05:00
Fix issue with pasting results in Teams (#13673)
* Fix issue with pasting results in Teams * Addressed comment to change header tag to th Co-authored-by: Monica Gupta <mogupt@microsoft.com>
This commit is contained in:
@@ -157,15 +157,16 @@ export class CopyQueryWithResultsKeyboardAction extends Action {
|
||||
let resultSummary = queryRunner.batchSets[0].resultSetSummaries[i];
|
||||
let result = await queryRunner.getQueryRows(0, resultSummary.rowCount, resultSummary.batchId, resultSummary.id);
|
||||
let tableHeaders = resultSummary.columnInfo.map((col, i) => (col.columnName));
|
||||
let htmlTableHeaders = resultSummary.columnInfo.map((col, i) => (`<th style="border:solid black 1.0pt; whiteSpace:nowrap">${escape(col.columnName)}</th>`));
|
||||
let htmlTableHeaders = `<thead><tr style="background-color:DarkGray">${resultSummary.columnInfo.map((col, i) => (`<th style="border:1.0px solid black;padding:3pt;font-size:9pt;font-weight: bold;">${escape(col.columnName)}</th>`)).join('')}</tr></thead>`;
|
||||
let copyString = '\n';
|
||||
let htmlCopyString = '<tr>';
|
||||
let htmlCopyString = '';
|
||||
|
||||
for (let rowEntry of result.rows) {
|
||||
htmlCopyString = htmlCopyString + '<tr>';
|
||||
for (let colIdx = 0; colIdx < rowEntry.length; colIdx++) {
|
||||
let value = rowEntry[colIdx].displayValue;
|
||||
copyString = `${copyString}${value}\t`;
|
||||
htmlCopyString = `${htmlCopyString}<td style="border:solid black 1.0pt;white-space:nowrap">${escape(value)}</td>`;
|
||||
htmlCopyString = `${htmlCopyString}<td style="border:1.0px solid black;padding:3pt;font-size:9pt;">${escape(value)}</td>`;
|
||||
}
|
||||
// Removes the tab seperator from the end of a row
|
||||
copyString = copyString.slice(0, -1 * '\t'.length) + '\n';
|
||||
@@ -175,7 +176,7 @@ export class CopyQueryWithResultsKeyboardAction extends Action {
|
||||
allResults = `${allResults}${tableHeaders.join('\t')}${copyString}\n`;
|
||||
allHtmlResults = `${allHtmlResults}<div><br/><br/>
|
||||
<table cellPadding="5" cellSpacing="1" style="border:1;border-color:Black;font-family:Segoe UI;font-size:12px;border-collapse:collapse">
|
||||
<tr style="background-color:DarkGray">${htmlTableHeaders.join('')}</tr>${htmlCopyString}
|
||||
${htmlTableHeaders}${htmlCopyString}
|
||||
</table></div>`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user