问题
I need to display lot of data in my chat. I want to display it in tabular form in chat emulator of bot framework.
For eg,
Ordered Food - Pizza Quantity - 1 Time - 1 pm
Ordered Food -Burger Quantity - 2 Time - 3pm
I want to display it in tabular way.
回答1:
As explained in the docs, the default text format for the messages is markdown. Markdown allows a nice balance of the bot being able to express what they want and for the each channel to render as accurately as they can.
The AzureBot is crafting a table using markdown:
var messageBuilder = new StringBuilder();
messageBuilder.AppendLine("|Id|Runbook|Start Time|End Time|Status|");
messageBuilder.AppendLine("|---|---|---|---|---|");
//...
messageBuilder.AppendLine($"|{job.FriendlyJobId}|{automationJob.RunbookName}|{startDateTime}|{endDateTime}|{status}|");
await context.PostAsync(messageBuilder.ToString());
Alternatively, you can try sending the text along with the \t
character code, like:
await context.PostAsync("test1\t\ttest2");
来源:https://stackoverflow.com/questions/40630617/show-data-in-chat-emulator-bot-framework